Reputation:
When I issue the following command:
git pull origin master
I get the following error:
Your local changes to the following files would be overwritten by merge: user.v12.suo
In my .gitignore file I just recently added the code to ignore *.suo files.
Can someone please explain why this is happening?
Upvotes: 2
Views: 175
Reputation: 518
Try removing the file first form the repo.
To remove the file from the repo and not delete it from the local file system use:
git rm --cached user.v12.suo
Upvotes: 0
Reputation: 27285
The problem is when you have already added that file you have to remove that file first. Otherwise that file will be marked as modified. For that you can use:
git rm --cached file [file ...]
With that you can remove that file from your repository.
Upvotes: 0
Reputation: 1573
When you add a pattern to your .gitignore this just tells git to ignore new files that match the pattern, however any files that git is already tracking will not be affected. You can tell git to stop tracking a file using this command:
git rm --cached <file>
This will remove it from the index as of the next commit.
Upvotes: 3