Skip to content
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 init flow says working tree contains unstaged changes, but it's not true #6401

Closed
TheJoeSchr opened this issue Oct 18, 2017 · 15 comments
Closed

Comments

@TheJoeSchr
Copy link

TheJoeSchr commented Oct 18, 2017

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.
@brodriro
Copy link

try :
git commit -m "TAG"
git push --all
git flow init -d

@TheJoeSchr
Copy link
Author

Thx, but sadly still the same results:

% git flow init -d
Fatal: Working tree contains unstaged changes. Aborting.

@TheJoeSchr
Copy link
Author

Even with force:

% git flow init -f -d
Fatal: Working tree contains unstaged changes. Aborting.

@brodriro
Copy link

check #81

@TheJoeSchr
Copy link
Author

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.

@TheJoeSchr
Copy link
Author

TheJoeSchr commented Oct 20, 2017

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 

@brodriro
Copy link

Nice, Now it's ok?

@TheJoeSchr
Copy link
Author

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.

@brodriro
Copy link

Close this issue :D

@TheJoeSchr
Copy link
Author

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

@montao
Copy link

montao commented Nov 21, 2017

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.

@jerryhu
Copy link

jerryhu commented Oct 19, 2018

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

@gongAll
Copy link

gongAll commented Jan 7, 2020

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 :)

@gitressa
Copy link

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

@marmelin
Copy link

marmelin commented Apr 9, 2024

Hi, there is always one where it did not work it out :)

❯ git reset --hard
HEAD ist jetzt bei b09828d9 update version to 1.13.7-SNAPSHOT
❯ git -c core.quotepath=false -c log.showSignature=false flow init
Fatal: Working tree contains unstaged changes. Aborting.
❯ git stash
Keine lokalen Änderungen zum Speichern
❯ git flow init
Fatal: Working tree contains unstaged changes. Aborting.

I am also using git-crypt, but that does not show any problems. No stashes nowhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants