File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -74,6 +74,7 @@ smart people at [Hashrocket](http://hashrocket.com/).
74
74
- [ Staging Stashes Interactively] ( git/staging-stashes-interactively.md )
75
75
- [ Stashing Only Unstaged Changes] ( git/stashing-only-unstaged-changes.md )
76
76
- [ Stashing Untracked Files] ( git/stashing-untracked-files.md )
77
+ - [ Untrack A File Without Deleting It] ( git/untrack-a-file-without-deleting-it.md )
77
78
- [ Verbose Commit Message] ( git/verbose-commit-message.md )
78
79
- [ Whitespace Warnings] ( git/whitespace-warnings.md )
79
80
Original file line number Diff line number Diff line change
1
+ # Untrack A File Without Deleting It
2
+
3
+ Generally when I invoke ` git rm <filename> ` , I do so with the intention of
4
+ removing a file from the project entirely. ` git-rm ` does exactly that,
5
+ removing the file both from the index and from the working tree.
6
+
7
+ If you want to untrack a file (remove it from the index), but still have it
8
+ available locally (in the working tree), then you are going to want to use
9
+ the ` --cached ` flag.
10
+
11
+ ``` bash
12
+ $ git rm --cached < filename>
13
+ ```
14
+
15
+ If you do this, you may also consider adding that file to the ` .gitignore `
16
+ file.
17
+
18
+ [ source] ( http://stackoverflow.com/questions/15027873/untrack-and-stop-tracking-files-in-git )
You can’t perform that action at this time.
0 commit comments