On Mon, May 19, 2014 at 09:12:47PM +0630, Arup Rakshit wrote:
> Is there any difference between the below 2 commands ? I didn't see anything.
>
> git rm --cached -- <file1> .. <fileN>
This one removes the index entries for those files.
> git checkout -- <file1> .. <fileN>
This one checks out the content from the index into the working tree
(for just those files).
Try:
# setup...
git init
echo content >file
git add file
git commit -m one
# now rm
git rm --cached -- file
git status
which yields:
rm 'file'
On branch master
Changes to be committed:
deleted: file
Untracked files:
file
but it we restore our state and try checkout:
git reset
git checkout -- file
nothing happens:
On branch master
nothing to commit, working directory clean
but if you had changes in the working tree:
echo changes >file
git status | sed 's/^/before> /'
git checkout -- file
git status | sed 's/^/ after> /'
you get:
before> On branch master
before> Changes not staged for commit:
before> modified: file
before>
before> no changes added to commit
after> On branch master
after> nothing to commit, working directory clean
Does that help?
-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html