1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-03 07:08:01 +00:00

Add Untrack A File Without Deleting It as a git til.

This commit is contained in:
jbranchaud
2015-10-15 10:49:29 -05:00
parent 5abe41eb4d
commit 693bd12dbb
2 changed files with 19 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
# Untrack A File Without Deleting It
Generally when I invoke `git rm <filename>`, I do so with the intention of
removing a file from the project entirely. `git-rm` does exactly that,
removing the file both from the index and from the working tree.
If you want to untrack a file (remove it from the index), but still have it
available locally (in the working tree), then you are going to want to use
the `--cached` flag.
```bash
$ git rm --cached <filename>
```
If you do this, you may also consider adding that file to the `.gitignore`
file.
[source](http://stackoverflow.com/questions/15027873/untrack-and-stop-tracking-files-in-git)