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

Re: [PATCH v2 0/3] rebase: give precise error message

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 29, 2017, 06:47 UTC
Message-ID
<xmqqshcx4m54.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<1511925118.2486.2.camel@gmail.com>
Kaartic Sivaraam <kaartic.sivaraam@gmail.com> writes:
Show 11 quoted lines
>> I do not think the above is a good change in the first place for at
>> least two reasons.  By saying <ref>, the updated text says "not just
>> branches but you can also give tags and remote-tracking branches".
>
> I used <ref> as you could actually use tags, remote-tracking branches
> and even "notes" ...
> ...
> It just works (of course, I couldn't understand what it did)! I didn't
> want to lie to the user. So, I used <ref>. So, should we just update
> the <branch> part of the doc or should we update the code for 'rebase'?
> I'm unsure.
By saying <ref>, you are not covering these cases
	git rebase master HEAD^0
	git rebase master pu^2
where the command gets non refs.

Most of the time, people use a <branch>, and rare cases like these what a user can give is not restricted to a <ref>, so there is *no* value in replacing <branch> with <ref>. If we needed to replace it with something, replacing <branch> with [<branch> | <commit-ish>] is not wrong per-se, but I do not think it is an improvement.

As <branch> is merely a kind of <commit-ish>, it may be tempting to instead replace <branch> with <commit-ish>, but I do not think it is a good idea, either. No matter what you write there in the synopsis (and let's call it X), the description would have to say "when X is the name of a branch, that branch is checked out, its history gets rebased, and at the end, the tip of that branch points at the result. When X is not a branch but just a commit-ish, the HEAD is detached at that commit, its history gets rebased and you'll be left in that state". Having <branch> in that sentence is clear enough and any intelligent reader would understand what we mean by that notation: we are showing there can be various things that can come on the command line depicted in the SYNOPSIS section at the point where we have a placeholder called <branch>, and the argument does not necessarily have to be the name of a branch.

Previous: Kaartic SivaraamNext: Kaartic Sivaraam
Message 14 of 18 in “rebase: rebasing can also be done when HEAD is detached”
  1. rebase: rebasing can also be done when HEAD is detachedKaartic Sivaraam, Nov 21, 2017
  2. Junio C HamanoNov 22, 2017
  3. 0/3 rebase: give precise error messageKaartic Sivaraam, Nov 27, 2017
  4. 1/3 rebase: use a more appropriate variable nameKaartic Sivaraam, Nov 27, 2017
  5. 2/3 rebase: distinguish user input by quoting itKaartic Sivaraam, Nov 27, 2017
  6. 3/3 rebase: rebasing can also be done when HEAD is detachedKaartic Sivaraam, Nov 27, 2017
  7. Junio C HamanoNov 28, 2017
  8. Kaartic SivaraamNov 28, 2017
  9. 3/3 rebase: rebasing can also be done when HEAD is detachedKaartic Sivaraam, Dec 1, 2017
  10. Junio C HamanoNov 28, 2017
  11. Kaartic SivaraamNov 28, 2017
  12. Junio C HamanoNov 29, 2017
  13. Kaartic SivaraamNov 29, 2017
  14. Junio C HamanoNov 29, 2017
  15. 0/3 rebase: give precise error messagesKaartic Sivaraam, Dec 16, 2017
  16. 1/3 rebase: consistently use branch_name variableKaartic Sivaraam, Dec 16, 2017
  17. 2/3 rebase: distinguish user input by quoting itKaartic Sivaraam, Dec 16, 2017
  18. 3/3 rebase: rebasing can also be done when HEAD is detachedKaartic Sivaraam, Dec 16, 2017

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.