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

Re: [PATCH 2/3] rebase: accept -<number> as another way of saying HEAD~<number>

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 3, 2014, 21:48 UTC
Message-ID
<xmqqha7fnebn.fsf@gitster.dls.corp.google.com>
In-Reply-To
<vpq7g8bfws8.fsf@anie.imag.fr>
Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:
Show 13 quoted lines
> Michael Haggerty <mhagger@alum.mit.edu> writes:
>
>> Or perhaps "-NUM" should fail with an error message if any of the last
>> NUM commits are merges.  In that restricted scenario (which probably
>> accounts for 99% of rebases), "-NUM" is equivalent to "HEAD~NUM".
>
> Makes sense to me. So, -NUM would actually mean "rebase the last NUM
> commits" (as well as being an alias for HEAD~NUM), but would fail when
> it does not make sense (with an error message explaining the situation
> and pointing the user to HEAD~N if this is what he wanted).
>
> This would actually be a feature for me: I often want to rebase "recent
> enough" history, and when my @{upstream} isn't well positionned,...

Could you elaborate on this a bit? What does "isn't well positioned" mean? Do you mean "the upstream has advanced but there is no reason for my topic to build on that---I'd rather want to make sure I can view 'diff @{1} HEAD' and understand what my changes before the rebase was"? That is, what you really want is

	git rebase -i --onto $(git merge-base @{upstream} HEAD) @{upstream}
but that is too long to type?

If it is very common (and I suspect it is), we may want to support such a short-hand---the above does not make any sense without '-i', but I would say with '-i' you do not want to reBASE on an updated base most of the time. "git rebase -i @{upstream}...HEAD" or something?

Previous: Jeff KingNext: Matthieu Moy
Message 22 of 40 in “rebase: new convenient option to edit a single commit”
  1. rebase: new convenient option to edit a single commitNguyễn Thái Ngọc Duy, Feb 27, 2014
  2. Matthieu MoyFeb 27, 2014
  3. Jeff KingFeb 28, 2014
  4. Duy NguyenFeb 28, 2014
  5. Jeff KingFeb 28, 2014
  6. Philip OakleyFeb 28, 2014
  7. 0/3 rebase's convenient optionsNguyễn Thái Ngọc Duy, Mar 2, 2014
  8. 1/3 rev-parse: support OPT_NUMBER_CALLBACK in --parseoptNguyễn Thái Ngọc Duy, Mar 2, 2014
  9. Junio C HamanoMar 4, 2014
  10. 2/3 rebase: accept -<number> as another way of saying HEAD~<number>Nguyễn Thái Ngọc Duy, Mar 2, 2014
  11. Eric SunshineMar 2, 2014
  12. Duy NguyenMar 2, 2014
  13. Eric SunshineMar 2, 2014
  14. Eric SunshineMar 2, 2014
  15. Matthieu MoyMar 2, 2014
  16. Michael HaggertyMar 3, 2014
  17. Matthieu MoyMar 3, 2014
  18. Duy NguyenMar 3, 2014
  19. David KastrupMar 3, 2014
  20. Matthieu MoyMar 3, 2014
  21. Jeff KingMar 3, 2014
  22. Junio C HamanoMar 3, 2014
  23. Matthieu MoyMar 3, 2014
  24. Junio C HamanoMar 3, 2014
  25. 3/3 rebase: new convenient option to edit a single commitNguyễn Thái Ngọc Duy, Mar 2, 2014
  26. Eric SunshineMar 2, 2014
  27. Eric SunshineMar 2, 2014
  28. Michael HaggertyMar 3, 2014
  29. Duy NguyenMar 3, 2014
  30. David KastrupMar 3, 2014
  31. Eric SunshineMar 3, 2014
  32. Duy NguyenMar 4, 2014
  33. Michael HaggertyMar 4, 2014
  34. Duy NguyenMar 4, 2014
  35. Michael HaggertyMar 4, 2014
  36. Junio C HamanoMar 4, 2014
  37. rebase: new convenient option to edit/reword/delete a single commitNguyễn Thái Ngọc Duy, Mar 9, 2014
  38. Matthieu MoyMar 9, 2014
  39. Michael HaggertyMar 10, 2014
  40. Matthieu MoyMar 10, 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.