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

Re: [RFC/PATCH 1/2] rebuash - squash/rebase in a single step

From
Edmundo Carmona Antoranz <eantoranz@gmail.com>
Date
Jun 30, 2019, 15:09 UTC
Message-ID
<CAOc6etYMzOpEDs1GpLChAEhp2SbZcKjO82S=qm4P-t6SkUEWcw@mail.gmail.com>
In-Reply-To
<20190630065358.GB31264@sigill.intra.peff.net>
On Sun, Jun 30, 2019 at 12:54 AM Jeff King <peff@peff.net> wrote:
Show 13 quoted lines
>
>
> and then do:
>
>   git merge --squash feature
>
> I get the same merge that rebuash is doing (with R6 as the merge base,
> so we see F5 and R7 conflicting with each other). And then when I finish
> it with "git commit", the result is a linear strand with M3 at the tip
> (and its commit message is even auto-populated with information from the
> squashed commits).
>
> -Peff

From the point of view of the revisions that you produce in the end, it's the same thing, but you are not rebasing/squashing your feature branch, you are moving your upstream branch to where you want the squashed/rebased branch to be. So, in fact you would need more steps, something like (starting from your feature branch being checked out):

git checkout --detach $( git rev-parse --abbrev-ref --symbolic-full-name @{u} ) git merge --squash my-feature-branch git branch -f my-feature-branch git checkout my-feature-branch

Yes, it works. Only that with rebuash you would do (starting from the feature branch being checked out branch):

git rebuash
as long as the upstream branch is set, of course.

I think it makes more sense in terms of development flow of feature branches, if you know in the end you will give up a squashed branch:

modify commit modify commit git pull # no need to use pull --rebase, merges will be fine modify commit modify commit git pull git modify # now I'm ready to rebase/squash git fetch git rebuash

adding history could be done with an additional option (--hist (default) and --no-hist?)

But, as you said, it's not like it's not possible to do it (with a little more effort) with available tools like merge --squash

Previous: Jeff KingNext: Jeff King
Message 5 of 13 in “rebuash - squash/rebase in a single step”
  1. 1/2 rebuash - squash/rebase in a single stepEdmundo Carmona Antoranz, Jun 30, 2019
  2. 2/2 rebuash - support for statusEdmundo Carmona Antoranz, Jun 30, 2019
  3. Edmundo Carmona AntoranzJun 30, 2019
  4. Jeff KingJun 30, 2019
  5. Edmundo Carmona AntoranzJun 30, 2019
  6. Jeff KingJun 30, 2019
  7. Edmundo Carmona AntoranzJul 1, 2019
  8. Junio C HamanoJul 1, 2019
  9. Edmundo Carmona AntoranzJul 1, 2019
  10. Junio C HamanoJul 1, 2019
  11. Derrick StoleeJul 2, 2019
  12. Junio C HamanoJul 2, 2019
  13. Johannes SixtJul 2, 2019

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.