From: Jeff King <peff@peff.net>
To: Arup Rakshit <aruprakshit@rocketmail.com>
Cc: git@vger.kernel.org
Subject: Re: Any difference to unstage files using "git checkout" and "git rm"
Date: Mon, 19 May 2014 12:45:27 -0400 [thread overview]
Message-ID: <20140519164526.GA27176@sigill.intra.peff.net> (raw)
In-Reply-To: <2484900.5bGOI3HfEm@linux-wzza.site>
On Mon, May 19, 2014 at 09:27:47PM +0630, Arup Rakshit wrote:
> > Is there any difference between the below 2 commands ? I didn't see
> > anything.
> >
> > git rm --cached -- <file1> .. <fileN>
> > git checkout -- <file1> .. <fileN>
>
> Please Ignore the previous.
Too late. :)
> I apologize to rewriting and increase the load of this mailing list. I
> actually wanted to ask the below
>
> git rm -- cached -- <file1> .. <fileN>
> git reset HEAD <file1> .. <fileN>
OK, this is a more sensible comparison.
The first command will remove the entries from the index entirely, and
the second one will return them to their state in HEAD. So _if_ the
existing commit in HEAD did not have the files at all, the two are
identical.
But if the files were committed previously, then the second command will
return them to that state, not remove them entirely.
Does that make sense?
-Peff
next prev parent reply other threads:[~2014-05-19 16:45 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-19 14:42 Any difference to unstage files using "git checkout" and "git rm" Arup Rakshit
2014-05-19 14:57 ` Arup Rakshit
2014-05-19 16:45 ` Jeff King [this message]
2014-05-19 16:01 ` Jeff King
2014-05-19 16:11 ` Arup Rakshit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140519164526.GA27176@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=aruprakshit@rocketmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).