Git fails due to broken working tree file

I am not an expert on Google. Needless to say, I'm not even sure what this means or how to resolve it?

>> git merge admin_playground error: Untracked working tree file 'vendor/gems/panda-1.0.0/.gitignore' would be overwritten by merge. fatal: merging of trees 538b2824765956cc44c42a8ad628e4f4 and d5d4cda68518cd1c81bf70ba8c339fea6 failed 

I am trying to do a git merge and get this failure.

+7
source share
3 answers

This is because .gitignore not in your current branch (it is not tracked), but it is in the branch you are trying to merge. Add the .gitignore file and execute it, then try merging again; or delete the .gitignore file if you do not need it, and he is pleased that he is in another branch.

+8
source

Note: mipadi (the author of the accepted answer ) also mentioned this error message in the context of case conflicts between file names in different branches.

If cleaning up unused files is an acceptable option, then the extreme solution is mentioned in this answer (a git clean -f -d will delete all raw files and directories).
In your case, this can be excessive (or dangerous).

Another original solution :

 git checkout -f admin_playground # will overwrite files git checkout yourBranch # get back where you where when trying the merge git merge admin_playground 

This will force git to continue working and overwrite files.
I suppose you could use the -f option with merge , but switch to another branch and then fix the problem again, and I could merge the next time without any problems.

Note: on git merge there is actually no << 22> option.

+3
source

Try the commands below:

 git add * git stash git pull 
+1
source

All Articles