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.
Daniel Johnson committed
Aug 18, 2010 at 14:30 UTC
ec06c8961f1742ed6b248069a619aa938dbbbba7
1 file changed
+5
-3
basic/index.html
+5
-3
@@ -701,11 +701,13 @@ M hello.rb
701
included in the next commit snapshot, thereby effectively deleting it.</p>
702
703
<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>
707
708
<h4>
709
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>
711
</h4>
712
713
<p>
@@ -715,7 +717,7 @@ M hello.rb
717
snapshot and another file was added to the next one and the contents are
718
similar, Git figures it was most likely a rename. So, although the
719
<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
721
<code>git add</code> on the new file. You don't really need to use it, but
722
if it's easier, feel free.
723
</p>