Reputation: 1128
I've added my files to the gitignore:
db/development.sqlite3
log/development.log
And I've removed them from tracking on both my local computer and server:
git rm --cached db/development.sqlite3
git rm --cached log/development.log
Then I push from my local computer to the repo, and pull to the server using
git pull origin master
and I still get this error:
error: The following untracked working tree files would be removed by merge:
db/development.sqlite3
log/development.log
Please move or remove them before you can merge.
I do not want these files overwritten or deleted, I just want git to pull everything and ignore the existing files that store my database information. How do I get past this?
Upvotes: 2
Views: 1536
Reputation: 33666
Do this:
$ mv db/development.sqlite3 db/development.sqlite3_bak
$ mv log/development.log log/development.log_bak
$ git pull
$ rm db/development.sqlite3 log/development.log
$ mv db/development.sqlite3_bak db/development.sqlite3
$ mv log/development.log_bak log/development.log
Upvotes: 2
Reputation: 185
There are 2 "solutions" here. You can either copy the files somewhere else, do a pull, remove them completely, push and then copy back the other files.
Or you could do
git stash
git pull
git stash pop
This will cause the files to be removed on the server but they will be kept locally. Afterwards you won't need to do this again because of your .gitignore. That file will only be applied to files that weren't already tracked.
Upvotes: 3