gitflow icon indicating copy to clipboard operation
gitflow copied to clipboard

git flow start/finish reports unstaged changes when there are none to commit or push

Open devlins opened this issue 13 years ago • 24 comments

Sometimes when performing git flow start or finish, git flow will report:

fatal: Working tree contains unstaged changes. Aborting.

There is however nothing to commit and nothing to pull or push to/from the remote. The working copy is up to date.

I have had to work around this issue by creating false commits of changes to a "readme.txt" file in order to perform these steps, but this is tedious. Is there another command that I can use to see what is blocking the git flow start/finish command?

devlins avatar Nov 23 '10 12:11 devlins

Please provide a replay of your commands that lead to this issue. That would definitely make it easier to analyse what causes this issue. Try to keep it as short as possible.

nvie avatar Nov 26 '10 13:11 nvie

This could happen when you delete files and won't commit. Check the staged files with git diff --cached and commit.

albohlabs avatar Aug 22 '11 16:08 albohlabs

There is not output with git diff --cached . Any idea, how to resolve the issue?

vinitkumar avatar Nov 08 '12 16:11 vinitkumar

i have a same problem. Do you find any decision?

bekas avatar Dec 01 '12 16:12 bekas

The easiest solution is to commit the changes ,delete the repo and re clone it.

vinitkumar avatar Dec 01 '12 16:12 vinitkumar

thanks a lot

bekas avatar Dec 02 '12 08:12 bekas

Most of the time bug is hapening with eGit on Eclipse based ide's, when i use git bash or tortoise git this error does not appear

norbert-gaulia avatar Jan 19 '13 17:01 norbert-gaulia

git reset --hard origin/master can save your life!

rubyrider avatar May 10 '13 18:05 rubyrider

It is very strange however executing: git status and repeating the command works as a fix in my environment.:-)

georgezlatev avatar May 18 '13 12:05 georgezlatev

we are having the same effect like @georgezlatev working on MAC OS X with intellij Idea 13. Seems that git-flow does not register a commit in a timely fashion ;-)

Will this be fixed?

ghost avatar Aug 26 '14 09:08 ghost

I only get this error when trying to git flow finish from a subdirectory. It works from the repos root directory. Cheers guys

ghost avatar Oct 21 '14 15:10 ghost

Appreciate this thread is old but i'm sure others will still be getting this error and will find this thread. I am using SourceTree and was getting this error. I managed to fix this by right clicking on my feature branch and then merging into develop/origin. I was than able to push my committed changes and delete the feature branch.

WillettLuke avatar Jan 12 '15 12:01 WillettLuke

best Option would be if the scripts execute a git status before trying to finish a feature:

if output=$(git status --porcelain) && [ -z "$output" ]; then

finish

else

normal error

fi

ghost avatar Jan 12 '15 13:01 ghost

Is this also an issue when finishing a release/hotfix branch?

fspreng avatar Jan 13 '15 15:01 fspreng

yes. with Intellj-Gitflow Plugin and in Bash. when i run a 'git status' in bash and finish feature/release/hotfix it works.

ghost avatar Jan 13 '15 15:01 ghost

In SourceTree I was getting this error (I was trying to finish a current feature) when SourceTree showed there were no changes. It wasn't until I switched to the Terminal and did a git status it showed a typechange to a file that hadn't been committed (because it didn't show in SourceTree). The changes I had made in the project was a replacement of two .framework files, so a lot of internal changes to those .framework files occurred by the looks of it. Ultimately the error from SourceTree was in fact correct, but I'm disappointed that SourceTree could not show me this change that was stopping me from finishing my feature branch :(

DonnaLea avatar Apr 14 '15 02:04 DonnaLea

I confirm git status for me helps to see what the unstages changes are

dragGH102 avatar Oct 20 '15 15:10 dragGH102

git reset --hard works for me in such cases

bedrin avatar Dec 06 '15 10:12 bedrin

git reset --hard worked for me as git status did not display any uncommitted changes.

srajaiah avatar May 29 '16 14:05 srajaiah

Just do these commands in your terminal:

git status
git add .
git status
git commit -m 'Commit typechanges'

It works well for me ;)

Lapinou42 avatar Jun 30 '16 15:06 Lapinou42

I had the same problem. I was able to commit the feature branch but not do 'feature finish'. I switched to the root directory ran git flow feature finish , and it worked.

baidai avatar Apr 16 '19 13:04 baidai

First confirm that you are running git commands at the root of you project.

SidneyMachara avatar May 20 '21 13:05 SidneyMachara

removing index.lock solved the problem for me. But I've committed all changes before, so the code was up to date. It seems my solution looks well but not for all cases.

from the console: **_fatal: Unable to create 'project/.git/index.lock': File exists.

Another git process seems to be running in this repository, e.g. an editor opened by 'git commit'. Please make sure all processes are terminated then try again. If it still fails, a git process may have crashed in this repository earlier: remove the file manually to continue_**

amper01 avatar Apr 06 '22 08:04 amper01

  the best plane >>>
  1-remove branch   => .git/refs/heads  => rm -rf <nameBranch>
  2-remove index.lock and COMMIT_EDITMSG (maybe not found) => rm -f <name>
  3-and switch other branch and changes save in stash
  4-continue process git in project ...

meiadnoushadi avatar Jan 04 '23 21:01 meiadnoushadi