From ec06c8961f1742ed6b248069a619aa938dbbbba7 Mon Sep 17 00:00:00 2001 From: Daniel Johnson Date: Wed, 18 Aug 2010 14:30:51 -0400 Subject: [PATCH] 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. --- basic/index.html | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/basic/index.html b/basic/index.html index 82d9772..bce78de 100644 --- a/basic/index.html +++ b/basic/index.html @@ -701,11 +701,13 @@ M hello.rb included in the next commit snapshot, thereby effectively deleting it.

By default, a git rm file will remove the file from the - staging area entirely and also off your disk (the working directory).

+ staging area entirely and also off your disk (the working directory). To + leave the file in the working directory, you can use git rm --cached + .

git mv - git rm orig; mv orig new; git add new + git rm --cached orig; mv orig new; git add new

@@ -715,7 +717,7 @@ M hello.rb snapshot and another file was added to the next one and the contents are similar, Git figures it was most likely a rename. So, although the git mv command exists, it is superfluous - all it does is a - git rm, moves the file on disk, then runs a + git rm --cached, moves the file on disk, then runs a git add on the new file. You don't really need to use it, but if it's easier, feel free.