Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error: The following untracked working tree files would be overwritten by merge: .gitignore

Tags:

git

I am working on a web app with Angular JS. After Commit, I am trying to Pull the latest version of the other web developer to merge it with mine before I Push my latest changes. I am getting this error and don't know why is this happening because I had no problem on the previous pull / push.

error: The following untracked working tree files would be overwritten by merge:
.gitignore
Please move or remove them before you can merge.
like image 409
user3333901 Avatar asked Feb 20 '14 17:02

user3333901


People also ask

How do you solve error the following untracked working tree files would be overwritten by checkout?

Delete . gitignore file from appname/gen/ to solve this issue.


1 Answers

It appears you have created a local .gitignore file but have not commited it to the repository and the remote you are attempting to interact with (pull/push) now has a .gitignore. This would be the case for any file in your repo when this happens

Since .gitignore is not just any file, it affects the way git behaves, I would compare the two manually, create a file that is a union of the two, commit it and then merge, fixing any formatting issues that might exist.

These could be the exact same file, but git wouldn't know because you haven't added it locally. This isn't a file you want to be changing often because it can make checkouts behave differently.

Github maintains a list of useful .gitignore templates for most languages.

like image 75
bnjmn Avatar answered Nov 15 '22 12:11

bnjmn