Hi,
I can't git init flow
in an existing repo, what can I do to fix this?
There are no unstaged changes, it's a lie, I already did this:
% git flow init
Fatal: Working tree contains unstaged changes. Aborting.
% git reset --hard
HEAD is now at 5e30792
% gs
On branch feature-xyz
Your branch is ahead of 'origin/feature-xyz' by 1 commit.
(use "git push" to publish your local commits)
nothing to commit, working directory clean
% git flow init
Fatal: Working tree contains unstaged changes. Aborting.
try :
git commit -m "TAG"
git push --all
git flow init -d
Thx, but sadly still the same results:
% git flow init -d
Fatal: Working tree contains unstaged changes. Aborting.
Even with force:
% git flow init -f -d
Fatal: Working tree contains unstaged changes. Aborting.
check #81
thx, I already tried the suggestion in #81 before, and just tried them again, still no luck.
% git reset --hard origin/master
HEAD is now at 5e30792
% git flow init -f
Fatal: Working tree contains unstaged changes. Aborting.
% gs
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
% git status
git add .
git status
git commit -m 'Commit typechanges'
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
% git flow init -f
Fatal: Working tree contains unstaged changes. Aborting.
I finally got it to work, by making a new dir, repo and then pulling the remote git in. Maybe the problem is that I'm also using git-crypt?
For example
mkdir project-with-flow
cd project-with-flow
git init
git flow init
git remote add origin example.com/project.git
git pull
# do this for every branch
git branch --set-upstream-to=origin/master master
Nice, Now it's ok?
Yes, now everything seems to work. I only had it once again, with a git flow feature
command, but I can't remember which. Maybe publish
. I just did git push -u --all
then.
Close this issue :D
Ah damn, I just got it again, with git flow feature finish
, I now suspect it has something to do with using git crypt
. I will close this issue
I have the same problem. I'm just trying to do very simple and everyday tasks, then I added git and git-flow and now I can't use anything.
I got same issue and I tried below command which worked for me
git reset --hard
Refer: https://stackoverflow.com/questions/28251527/initializing-git-flow-in-existing-repository
I'm a bit too late, but what I usually do is something along the lines of:
git stash && git flow <command> && git stash pop
Hope this helps anyone in the future :)
Thanks @gongAll, that worked perfectly! A lot easier than resetting, and recreating the changes. To spell it out, these commands worked for me, after getting Fatal: Working tree contains unstaged changes. Aborting.
:
git stash
git flow init
git flow feature start my-new-flow-feature-branch
git stash pop
Most helpful comment
I got same issue and I tried below command which worked for me
Refer: https://stackoverflow.com/questions/28251527/initializing-git-flow-in-existing-repository