0

Git won't allow me to pull some commits. I must add that one of those commits has a .gitignore change adding some files to it.

When I try to pull the commits it says that I have local changes to the same files that were added to .gitignore. but I cannot find any local changes, git status, git diff, source tree, all show no local change.

Biffen
  • 6,249
  • 6
  • 28
  • 36
schanti schul
  • 681
  • 3
  • 14

1 Answers1

1

First, if you have added files to .gitignore, make sure to have remove them as well, otherwise they would still be tracked.

git rm --cached -- anIgnoredFile
git commit -m "record file deletion/ignore"

Second, when you pull, try a rebase instead of a merge, which you can automate with:

git config --global pull.rebase true
git config --global  rebase.autoStash true

Then try again your git pull: this time it should re-apply your local changes on top of the updated history.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250