New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
git flow init fails on cloned repo. #121
Comments
I'm having the exact same problem. I haven't created a master branch locally yet (as that does seem wrong to me as well), but I haven't found a different solution yet. Will post again if I can find something, however. |
So far, the only solution I've found is to create the master branch, even if it's not being used. It's not pleasant, but it works. Hopefully there'll be a fix for it soon! |
Wouldn't it be wisest to track the initial master branch, e.g. |
Sure... If there is one! When creating new projects, I don't push an So its still a problem. Sent from my Windows Phone (yes you read that correctly) From: shuane Reply to this email directly or view it on GitHub: |
+1 same issue... |
+1 same issue |
What is the philosophical reason behind not wanting to push the empty initial master branch (that is created by default) when the repository is first created? If you don't push the master branch (as it seems the commenters here have intentionally not done), then you cannot pull it into a clone. Git-flow is correct in not trying to create a new one, incase you have forgotten to check out a preexisting master branch and would then have a conflict if it created a new branch. |
There's nothing philosophical about this. It's to do with workflow. I can push a master branch, but it might not stop people grabbing just the development branch. Git-flow might be correct in not trying to create a new one. But instead of failing, why not ask me? "Do you want me to create a new branch or shall I track the remote master for you?" Thoughts? |
In the case of some people here there is no remote master because they think it would be wrong to push an empty branch. It would be useful for them to perform
to push both the develop and master branches initially to fix that part of the issue. If there was a remote master it would be useful to ask that question at that point, and shouldn't be too difficult for someone to implement. It is a simple fallback and won't affect anyone elses workflow if they create the master branch themselves. |
Here's how we ran into the issue. Most of our development right now in our git repo is on feature branches off of develop. I had set "develop" as the default branch of the repository on github. I wanted to work on a feature branch of a new machine. I cloned the repo, did "git flow init", and it failed. |
@lorin This goes to show there are a stack of ways that we can get bitten by this. Makes a lot of sense to me to have git-flow handle this case, even if it requires an annoying prompt it's still better than not working at all and relying people figuring it out by themselves. |
Part of this issue may be that git may only to fetch a single branch when you run git clone, and if you set the GitHub default branch to be something other than master, as I do myself as well, then master will not be there as a remote reference until you run git fetch origin (I think). If that is the case for many people, the commit that added the change for git-flow-init to support checking for remotes/origin/master [1] may need to be extended to add a "git fetch origin" call before checking whether the master exists. [1] baf163e |
The git clone operation literally clone the repository as noted in the progit boot, you can disconnect your network wire and do:
git will create you the local branch called master as a copy of origin/master. |
Note:
is sufficient as if the branch is not found but there is a tracking branch that one is used. |
@kasterma thank you!
To get the local branch:
Now run git flow init as normal.
|
git config gitflow.branch.master master to set your master branch properly when you cannot "cancel" a git flow init. |
Same here, I have the same issue. |
+1 same issue |
+1 |
Just ran into this. Garrrgh! +1 |
Make sure to checkout master at least once on your local repo. |
I will thanks On Nov 18, 2016 6:41 PM, "Rob Moore" notifications@github.com wrote:
|
+1 Happened to me too. |
did following steps to fix the issue on cloned repo
|
My TeamCity CI process can wrap a build within a git flow release via ant scripts, but I learned along the way that it was necessary to checkout both
|
works for me! thank you |
The solution is: |
@andres310597 That may be the answer for you. It did not help on my repo.
And my |
The fact that this issue has remained open for 9 years says a lot about our chances that it'll get resolved any time soon. However, I accepted the defaults and received this message: |
I might be doing this wrong, but if I attempt to clone a repo that only has a
develop
branch and then try to start a feature usinggit flow feature start foo
then it tells me to re-initialize git flow. Runninggit flow init
fails because themaster
branch doesn't exist. I have to manually create it for it to work.This seems wrong to me. Behind the scenes, surely, git flow should either create the required branches or just deal with them not being there. Does this sound like a bug?
Here's a sample session:
Thanks!
OJ
The text was updated successfully, but these errors were encountered: