Thread (1 message) 1 message, 1 author, 2016-06-15

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

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:47:36

Johannes Sixt [off-list ref] writes:
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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help