git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] git-rebase: Print name of rev when using shorthand

From
Brian Gesiak <modocache@gmail.com>
Date
Apr 16, 2014, 23:22 UTC
Message-ID
<CAN7MxmWHPaxC0vzJxnJjcarpSh2SsdzhuTbt1rSiJhNS0U8K0Q@mail.gmail.com>
In-Reply-To
<xmqqa9blgkew.fsf@gitster.dls.corp.google.com>
Show 10 quoted lines
> The concept of "n-th prior checkout" (aka @{-n}) and "immediately
> previous checkout" (aka "-") are equivalent, even though the former
> may be more generic.
>
> You seem to be saying that those who understand the former are with
> superiour mental capacity in general than those who only know the
> latter, and they can always remember where they came from.
>
> ...have you considered _why_ it is a good thing to show the symbolic
> name in the first place?

I think I failed to express my point here; I don't think people that use "@{-1}" have superior mental capacity, but rather simply that they are aware of the "@{-n}" method of specifying a previous reference. So in response to the command "git rebase @{-4}", displaying the result "Fast-forwarded HEAD to @{-4}" does not contain any unknown syntax that may confuse them. They may not remember what "@{-4}" refers to, but they are aware of the syntax at least.

On the other hand, people who use the "-" shorthand may or may not be aware of the "@{-n}" syntax. In that respect, I think it would be confusing to display "Fast-forwarded HEAD to @{-1}" in response to the command "git rebase -"; the user may not know what "@{-1}" means!

Thus my original point was that I felt displaying a symbolic name in response to "git rebase -" was more important than doing so in response to "git rebase @{-1}". The issue isn't about forgetting what "@{-n}" refers to, it's whether the user even knows what "@{-n}" is supposed to mean.

But in light of your other comments:
Show 22 quoted lines
>> Furthermore, were we to translate "@{-1}", does that mean we
>> should also translate "@{-2}" or prior?
>
> Surely, why not.  If a user is so forgetful to need help remembering
> where s/he was immediately before, wouldn't it be more helpful to
> give "here is where you were" reminder for older ones to allow them
> to double check they specified the right thing and spot possible
> mistakes?
>
> ...
>
> Giving the symbolic name 'master' is good because it is possible
> that the user thought the previous branch was 'frotz', forgetting
> that another branch was checked out tentatively in between, and the
> user ended up rebasing on top of a wrong branch.  Telling what that
> previous branch is is a way to help user spot such a potential
> mistake.  So I am all for making "rebase -" report what concrete
> branch the branch was replayed on top of, and consider it an incomplete
> improvement if "rebase @{-1}" (or "rebase @{-2}") did not get the
> same help---especially when I know that the underlying mechanism you
> would use to translate @{-1} back to the concrete branch name is the
> same for both cases anyway.

I had not originally thought of this, perhaps because I was preoccupied with preventing users from seeing syntax they might not be aware of. But I definitely agree that displaying symbolic names for all "@{-n}" is a good way to prevent user error.

> I can buy "that would be a lot more work, and I do not want to do it
> (or I do not think I can solve it in a more general way)", though.
Perish the thought! :)
I will try to re-roll this patch to include symbolic names for "@{-n}".
As usual, thanks for the feedback!
- Brian Gesiak
Previous: Junio C Hamano
Message 6 of 6 in “git-rebase: Print name of rev when using shorthand”
  1. git-rebase: Print name of rev when using shorthandBrian Gesiak, Apr 13, 2014
  2. Junio C HamanoApr 14, 2014
  3. Brian GesiakApr 16, 2014
  4. Junio C HamanoApr 16, 2014
  5. Junio C HamanoApr 16, 2014
  6. Brian GesiakApr 16, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.