git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Felipe Contreras <felipe.contreras@gmail.com>
To: Jakub Narebski <jnareb@gmail.com>
Cc: Scott Chacon <schacon@gmail.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Theodore Tso <tytso@mit.edu>, Elijah Newren <newren@gmail.com>,
	git list <git@vger.kernel.org>
Subject: Re: EasyGit Integration
Date: Sat, 13 Jun 2009 00:48:36 +0300	[thread overview]
Message-ID: <94a0d4530906121448m57f272eej32e8d57e48002f1f@mail.gmail.com> (raw)
In-Reply-To: <200906122321.57479.jnareb@gmail.com>

On Sat, Jun 13, 2009 at 12:21 AM, Jakub Narebski<jnareb@gmail.com> wrote:
> On Fri, 12 Jun 2009, Felipe Contreras wrote:
>> On Thu, Jun 11, 2009 at 3:42 AM, Jakub Narebski<jnareb@gmail.com> wrote:
>>> On Thu, 11 June 2009, Felipe Contreras wrote:
>
>>>> 'git reset' also gets something out of the repository and into the
>>>> working area, that's not reason enough to put them under the same
>>>> 'checkout' command, is it?
>>>
>>> Nope. 'git reset' resets something to the state in repository (to given
>>> commit).  The fact that some combination of options for 'git reset' gives
>>> the same result as some specific combination of options of 'git checkout'
>>> means only that one can arrive at some destination in two different ways.
>>
>> You can describe what 'git reset' does in many ways, but in the
>> process it's still getting something out of the repository and into
>> the working directory, does it not? 'git checkout <commitish>' and
>> 'git checkout <commitish> -- <path>' also do that.
>
> Nope. 'git reset' always reset some part of state to a given commit,
> HEAD by default.  It can reset current branch with --soft, branch plus
> index with --mixed (default), and branch plus index plus working
> directory with --hard.  Source is always commit.

You said it: 'git reset --hard' gets something out of the repository
and into the working directory.

Try this:
git checkout <random sha-1 with no ref>

Then what is the difference between:
git checkout HEAD^
git reset --hard HEAD^

In this case they do exactly the same thing, don't they?

> 'git checkout' however checks out something into working directory.
> It can be branch, in which turns it sets HEAD to point to it, and
> index too.  It can be file, in which it gets version of file from
> index or (if specified) from given commit.  Destination is always
> working area (and sometimes something else beside it).
>
>>
>> Is that relevant? No. What is relevant is the final action the user is
>> expecting to achieve.
>>
>> Therefore, the fact that 'git checkout <commitish>' modifies the
>> working directory is irrelevant, it's still doing an extra step;
>> update HEAD, and that final action is what is important for this
>> particular command; it switches to another commitish.
>
> It is not uncommon for a word to have different meaning depending on
> context, or on some auxiliary word used in addition...

We are talking about a command here, not a command that has two slight
variations of the same main action, a command that is doing *two*
completely unrelated actions depending on the context.

Think about these 3 actions:
a) get a path out of a commit in the repository and into the working directory
b) switch to another commit, reseting the working directory
c) reset current branch to certain commit, and checkout into the
working directory

The 3 actions require putting something into the working directory;
what makes a) and b) so similar they belong to the same command?

-- 
Felipe Contreras

  reply	other threads:[~2009-06-12 21:48 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-09 18:59 EasyGit Integration Scott Chacon
2009-06-09 19:43 ` Nicolas Pitre
2009-06-09 19:52 ` Avery Pennarun
2009-06-09 20:37   ` Björn Steinbrink
2009-06-09 20:42     ` Avery Pennarun
2009-06-10 12:13       ` Björn Steinbrink
2009-06-09 20:49     ` Elijah Newren
2009-06-10  1:09   ` Miles Bader
2009-06-09 20:12 ` Björn Steinbrink
2009-06-09 20:40   ` Elijah Newren
2009-06-09 21:18     ` Björn Steinbrink
2009-06-09 21:27 ` Björn Steinbrink
2009-06-09 21:36   ` Junio C Hamano
2009-06-09 21:48   ` Elijah Newren
2009-06-09 22:00 ` Elijah Newren
2009-06-10 12:52   ` Matthieu Moy
2009-06-09 22:14 ` Linus Torvalds
2009-06-09 22:30   ` Elijah Newren
2009-06-09 22:40     ` Linus Torvalds
2009-06-10  0:40       ` Mark Lodato
2009-06-10  3:11       ` Miles Bader
2009-06-10  3:32       ` Theodore Tso
2009-06-10  4:03         ` Linus Torvalds
2009-06-10 22:31           ` Felipe Contreras
2009-06-10 23:04             ` Linus Torvalds
2009-06-10 23:57               ` Scott Chacon
2009-06-11  0:15                 ` Jakub Narebski
2009-06-11  0:30                   ` Felipe Contreras
2009-06-11  0:42                     ` Jakub Narebski
2009-06-12 20:57                       ` Felipe Contreras
2009-06-12 21:21                         ` Jakub Narebski
2009-06-12 21:48                           ` Felipe Contreras [this message]
2009-06-12 22:05                             ` Jakub Narebski
2009-06-12 22:30                               ` Felipe Contreras
2009-06-13  1:24                                 ` Björn Steinbrink
2009-06-11  0:18               ` Felipe Contreras
2009-06-10  4:20         ` Elijah Newren
2009-06-10 14:40       ` Matthieu Moy
2009-06-10  1:25   ` Sam Vilain
2009-06-10  1:59     ` Linus Torvalds
2009-06-10  2:18     ` Junio C Hamano
2009-06-10  2:52       ` Sam Vilain
2009-06-10  6:43         ` Jakub Narebski
2009-06-10  3:27       ` Nicolas Pitre
2009-06-10 20:47         ` Junio C Hamano
2009-06-10 22:28           ` Elijah Newren
2009-06-10 16:48       ` Scott Chacon
2009-06-10 22:15       ` Felipe Contreras
2009-06-10 22:04 ` Felipe Contreras

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=94a0d4530906121448m57f272eej32e8d57e48002f1f@mail.gmail.com \
    --to=felipe.contreras@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=jnareb@gmail.com \
    --cc=newren@gmail.com \
    --cc=schacon@gmail.com \
    --cc=torvalds@linux-foundation.org \
    --cc=tytso@mit.edu \
    /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).