Reputation: 831
I made a commit and now when I try to pull i get this error.
error: The following untracked working tree files would be overwritten by merge:
login/models.pyc
timer/__init__.pyc
timer/admin.pyc
timer/api.pyc
timer/email.pyc
timer/exceptions.pyc
timer/models.pyc
timer/serializers.pyc
timer/urls.pyc
timer/views.pyc
Please move or remove them before you can merge.
Aborting
This is how my .gitignore looks like
*.pyc
*.~
*.swp
*.xml
*.iml
I have added the pyc files in gitignore yet they are commited. What have I done wrong and how can I make a successful pull now?
Upvotes: 0
Views: 897
Reputation: 224
If you add a file/ext/folder in .gitignore file, then push .gitignore file first. Git status will still show you those files as 'not staged' if your gitignore changes are not pushed. I suggest you delete those files from git remote and then add them locally. Now git should work properly and ignore those files.
more details Here
Upvotes: 0
Reputation: 2062
If the files have been committed before ignoring them, you will need to remove them from the repository to make the ignore effective. How to do that is described in this answer.
In your case the files are changed locally as well as in the remote repository. Assuming that these are compiled files which can be reproduced at any time by compiling your source code, I would suggest to do the following:
git checkout -- filea fileb
).This will have the benefit to avoid conflicts in those files which are going to be deleted and ignored anyway.
Upvotes: 1