git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Boyd Stephen Smith Jr." <bss@iguanasuicide.net>
Cc: "Conor Rafferty" <conor.rafferty@altmore.co.uk>,
	"Jeff Whiteside" <jeff.m.whiteside@gmail.com>,
	"Daniel Barkalow" <barkalow@iabervon.org>,
	git@vger.kernel.org
Subject: Re: for newbs = little exercise / tutorial / warmup for windows and other non-sophisticated new Git users :-) [Scanned]
Date: Tue, 30 Dec 2008 20:48:20 -0800	[thread overview]
Message-ID: <7v7i5hymp7.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <200812302141.02248.bss@iguanasuicide.net> (Boyd Stephen Smith, Jr.'s message of "Tue, 30 Dec 2008 21:40:58 -0600")

"Boyd Stephen Smith Jr." <bss@iguanasuicide.net> writes:

> On Tuesday 2008 December 30 20:30:46 Conor Rafferty wrote:
>> MERCURIAL:
>>
>> Update
>> hg update [-C] [-d DATE] [[-r] REV]
>
> Which is the role of "git checkout <branch>"
>
> "git checkout <branch> <paths>" is similar to "hg revert -r <branch> <paths>", 

No it is not.

The form of the command is makes this request:

    Please look into that named <tree-ish>, and check out the named
    <paths> out of it to my work tree.  Because the reason I want them in
    my work tree is so that I can include them as part of the next commit
    I am preparing to create in the index, please update these paths in my
    index while at it.

After working for some time on top of the current HEAD to make changes to
existing files in "lib/" directory, if you notice that none of your
changes in the directory does not make any sense, you may rather want to
start over from the version that you began with.  In such a case, you
would make the above request with <tree-ish> equal to HEAD and <paths>
equal to "lib", i.e.

    git checkout HEAD lib

and as the end result you may be able to achieve "reverting my crappy
changes to all of the files in lib/".

HOWEVER.

Read what the above request says carefully again, and think about what
would happen to a path that exists in the work tree but not in the named
<tree-ish>.

In other words, what would happen to a new file you added since you
started working on top of HEAD?

See?

A new file that you added in lib/ directory since you started working will
not be molested in any way, because they do not even exist in the
<tree-ish>.

If you think "git checkout <tree-ish> <paths>" has anything to do with
reverting, you will keep confusing yourself.  The command is "checking out
the named paths out of the named tree", and absense of a file is not
something that is checked out by this operation.

  reply	other threads:[~2008-12-31  4:50 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-31  2:30 for newbs = little exercise / tutorial / warmup for windows and other non-sophisticated new Git users :-) [Scanned] Conor Rafferty
2008-12-31  3:40 ` Boyd Stephen Smith Jr.
2008-12-31  4:48   ` Junio C Hamano [this message]
2008-12-31  5:21     ` Daniel Barkalow
2008-12-31  6:07       ` Junio C Hamano
2008-12-31 15:14     ` Boyd Stephen Smith Jr.
  -- strict thread matches above, loose matches on Subject: below --
2008-12-31 11:10 Conor Rafferty
2008-12-31 16:00 ` Daniel Barkalow
2008-12-31 10:59 Conor Rafferty
2008-12-31  2:27 Conor Rafferty
2008-12-31  2:35 ` Jeff Whiteside
2008-12-31  2:56 ` Boyd Stephen Smith Jr.
2008-12-31  3:10 ` Daniel Barkalow
2008-12-31  3:49   ` Daniel Barkalow
2008-12-31 12:17     ` Zorba
2008-12-31 13:48       ` Sitaram Chamarty
2008-12-31 16:24       ` Daniel Barkalow
2008-12-31 16:33         ` Sitaram Chamarty
2008-12-31 12:03   ` Zorba
2008-12-31 13:37     ` Sitaram Chamarty
2008-12-30 22:55 Conor Rafferty
2008-12-31  0:12 ` Boyd Stephen Smith Jr.
2008-12-31  2:22 ` Sitaram Chamarty
2008-12-30 22:36 Conor Rafferty
2008-12-30 23:31 ` Boyd Stephen Smith Jr.
2008-12-31  0:15 ` Daniel Barkalow
2008-12-31  2:22   ` Jeff Whiteside

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=7v7i5hymp7.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=barkalow@iabervon.org \
    --cc=bss@iguanasuicide.net \
    --cc=conor.rafferty@altmore.co.uk \
    --cc=git@vger.kernel.org \
    --cc=jeff.m.whiteside@gmail.com \
    /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).