user3333901
user3333901

Reputation: 61

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

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.

Upvotes: 6

Views: 22261

Answers (1)

bnjmn
bnjmn

Reputation: 4584

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.

Upvotes: 5

Related Questions