git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Zabre <427@free.fr>
Cc: git@vger.kernel.org
Subject: Re: (beginner) git rm
Date: Wed, 28 Jan 2009 13:29:36 -0800	[thread overview]
Message-ID: <7vab9bm85b.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <1233175322729-2234796.post@n2.nabble.com> (427@free.fr's message of "Wed, 28 Jan 2009 12:42:02 -0800 (PST)")

Zabre <427@free.fr> writes:

> Björn Steinbrink wrote:
>> 
>> The "git checkout -- d.txt" is also a valid command, but that restores
>> the file from the index.
>> 
>> git checkout -- paths
>> 	==> Copy "paths" from the index to the working tree
>> 
>> git checkout <tree-ish> -- paths
>> 	==> Copy "paths" from the tree-ish to the index and working tree
>> 
>> So, for "rm d.txt", a plain "git checkout -- d.txt" would also do the
>> trick, as d.txt is still in the index. But your "git rm d.txt" also
>> removed the file from the index, and thus that checkout does nothing.
>> But "git checkout HEAD -- d.txt" works, as it gets the file from HEAD
>> and puts it into the index and working tree.
>
> This is enlightening, thank you very much!
> (I knew I would love git more and more)
>
> Oh just one (probably stupid) thing : <tree-ish> does represent a directory
> being the root of a tree of folders (which has been added to the index),
> does it?

Yeah, it typically is a commit object.

Björn said "Copy", but the operation really is like checking out a book
from a library and "checkout" is a good word for it.  "I do not like what
I have in my work tree, and I'd like to replace it with a fresh one taken
out of the index (or, out of that commit)".

  parent reply	other threads:[~2009-01-28 21:31 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-28 10:11 (beginner) git rm Zabre
2009-01-28 10:36 ` Peter Krefting
2009-01-28 11:05   ` Zabre
2009-01-28 11:37     ` Tomas Carnecky
2009-01-28 12:00       ` Zabre
2009-01-28 12:19         ` Tomas Carnecky
2009-01-28 13:03           ` Theodore Tso
2009-01-28 18:25             ` Zabre
2009-01-28 18:23           ` Zabre
2009-01-28 20:17             ` Björn Steinbrink
2009-01-28 20:42               ` Zabre
2009-01-28 21:05                 ` Zabre
2009-01-28 21:29                 ` Junio C Hamano [this message]
2009-01-28 22:13                   ` Björn Steinbrink
2009-01-28 22:33                     ` Junio C Hamano
     [not found]                       ` <6bef44ba0901281711m2d05e70fj4dd3ae03d7fe1052@mail.gmail.com>
2009-01-29  2:34                         ` Björn Steinbrink

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=7vab9bm85b.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=427@free.fr \
    --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).