Reputation: 4798
I have some files in my central remote repository. I committed those in the past. They don't need to be tracked anymore. I add them to my .gitignore file. But I still need them in my local repo, for my local site.
What do I have to do, to get them out of my remote repository but still keep them in my local repository?
Upvotes: 1
Views: 928
Reputation: 4583
[Edited]
you have to remove them from git with git rm --cached foo.txt
. This will mark them as deleted in the repo, but not physically delete them.
So, here's a full print out :
master!git> git status
On branch master
nothing to commit, working directory clean
master!git> ls -la
total 0
drwxr-xr-x 4 creynder staff 136 Apr 13 13:14 .
drwxr-xr-x@ 52 creynder staff 1768 Apr 13 13:14 ..
drwxr-xr-x 12 creynder staff 408 Apr 13 13:14 .git
-rw-r--r-- 1 creynder staff 0 Apr 13 13:14 foo.txt
master!git> git rm --cached foo.txt
rm 'foo.txt'
master!git *> git status
On branch master
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
deleted: foo.txt
Untracked files:
(use "git add <file>..." to include in what will be committed)
foo.txt
master!git *> git commit -m 'Delete foo.txt'
Then add "foo.txt" to .gitignore.
Upvotes: 2