Reputation: 178
I have a folder containing some code that will be required by anyone downloading my repository to their computer, but isn't needed by me. Let's call it foo
.
I want to be able to delete foo
from my local system, but not from the remote repository. I obviously cannot add it to .gitignore
because it has already been tracked.
Is this possible with Git? If so, how can I do this? Any help would be much appreciated.
Upvotes: 2
Views: 154
Reputation: 142174
Mark the files with assume unchanged and then delete them. From this point on git will ignore any changes made to those files.
https://git-scm.com/docs/git-update-index
--assume-unchanged
git update-index --assume-unchanged <path>
In case you need to print out list of files marked with the --assume-unchanged
flag:
git ls-files -v|grep '^h'
Upvotes: 4