I have files and folder (let's say settings.py and migrations/ folder) in my local filesystem that I don't want to track anymore. (They were tracked the first time, when I push my code on my remote server).
What I want : when I run a git pull
on my remote server I update only the code tracked and let the settings.py
andmigrations/
folder off the update.
So here's what I did :
(on my local filesystem)
First,
I added `myapp/settings.py` and `migrations/` in my .gitignore file.
Then,
git rm --cached myapp/settings.py
git rm --cached -r migrations/
git add .
git commit -m "remove settings.py and migrations folder"
git push -u origin master
The settings.py file and migrations folder were successfully removed from my GitHub repo.
My problem : when I run a git pull
on my remote server (when there is modifications of settings.py and migrations folder), it is as if settings.py and migrations folder were still tracked. :
$me@server git pull origin master
....
error: Your local changes to the following files would be overwritten by merge:
migrations/0001_initial.py
myapp/settings.py
Please, commit your changes or stash them before you can merge.
Aborting
I would like the server to ignore these changes since I have them untracked from my repo.
Another helpful information ? :
I don't know if that can I help but I do not want to commit changes from my remote to the GitHub repo, I just want to pull the changes from the GitHub repo (because the 'right' code must come from my local repo, except for settings.py and migrations folder which are different on remote).
So, if that can be of any help, here is the result of git status
on my remote server:
# On branch master
# Your branch is behind 'origin/master' by 5 commits, and can be fast-forwarded.
#
# Changes not staged for commit:
# (use "git add/rm <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# deleted: catalog/migrations/0004_auto_20150115_1214.pyc
# deleted: catalog/migrations/0005_auto_20150116_0855.py
# deleted: catalog/migrations/0005_auto_20150116_0855.pyc
# deleted: catalog/migrations/0006_auto_20150119_1153.py
# modified: myapp/settings.py
#
Thanks a lot for the help!