Skip to content

Commit ec06c89

Browse files
committed
fix description of "git rm" and "git mv" to mention --cached
using git rm removes the file from the index AND the working directory, so trying to mv the file to the new name wouldn't actually work. If you use "git rm --cached" the file still exists to be worked with.
1 parent d0aaa08 commit ec06c89

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

basic/index.html

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -701,11 +701,13 @@ <h2>
701701
included in the next commit snapshot, thereby effectively deleting it.</p>
702702

703703
<p>By default, a <code>git rm file</code> will remove the file from the
704-
staging area entirely and also off your disk (the working directory).</p>
704+
staging area entirely and also off your disk (the working directory). To
705+
leave the file in the working directory, you can use <code>git rm --cached
706+
</code>.</p>
705707

706708
<h4>
707709
git mv
708-
<small>git rm orig; mv orig new; git add new</small>
710+
<small>git rm --cached orig; mv orig new; git add new</small>
709711
</h4>
710712

711713
<p>
@@ -715,7 +717,7 @@ <h4>
715717
snapshot and another file was added to the next one and the contents are
716718
similar, Git figures it was most likely a rename. So, although the
717719
<code>git mv</code> command exists, it is superfluous - all it does is a
718-
<code>git rm</code>, moves the file on disk, then runs a
720+
<code>git rm --cached</code>, moves the file on disk, then runs a
719721
<code>git add</code> on the new file. You don't really need to use it, but
720722
if it's easier, feel free.
721723
</p>

0 commit comments

Comments
 (0)