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

Re: Any way to "flatten" a series of changes in git

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 23, 2009, 06:16 UTC
Message-ID
<7v4opqeitj.fsf@alter.siamese.dyndns.org>
In-Reply-To
<4AE143BC.7040507@viscovery.net>
Johannes Sixt <j.sixt@viscovery.net> writes:
Show 13 quoted lines
> The easiest way (IMHO) to achieve this is certainly:
>
>   # start a new branch at the tip of the series
>   $ git checkout -b all-in-one the-series
>
>   # squash 17 commits
>   $ git reset --soft HEAD~17
>   $ git commit
>
> Now you have a new branch 'all-in-one' that has the same contents as the
> original series 'the-series', but with only one commit:
>
>   $ git diff the-series..all-in-one  # must show no differences

I think --squash "*merge*" is conceptually simpler to explain *and* has an added advantage that it helps preparing the consolidated log message.

    # start from the last customer dump
    $ git checkout -b customer-update last-release
    # give the customer the greatness in the series, content-wise
    $ git merge --squash the-series
    $ git commit

This will start the "customer-update" branch starting from the last dump you gave to the customer, merge in the changes made in the series without history, and when you make a commit, you will have access to all the individual log messages in the series to look at as reference, so that you can cut and paste from them to summarized message instead of typing everything anew.

Previous: Johannes Sixt
Message 14 of 14 in “Any way to "flatten" a series of changes in git”
  1. Howard MillerOct 22, 2009
  2. Bill LearOct 22, 2009
  3. Bill LearOct 22, 2009
  4. Jacob HelwigOct 22, 2009
  5. Howard MillerOct 22, 2009
  6. Daniele SegatoOct 26, 2009
  7. Jakub NarebskiOct 22, 2009
  8. Howard MillerOct 22, 2009
  9. Howard MillerOct 22, 2009
  10. Jakub NarebskiOct 22, 2009
  11. Howard MillerOct 23, 2009
  12. Howard MillerOct 23, 2009
  13. Johannes SixtOct 23, 2009
  14. Junio C HamanoOct 23, 2009

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.