Re: Any way to "flatten" a series of changes in git
- From
Johannes Sixt <j.sixt@viscovery.net>
- Date
- Oct 23, 2009, 05:48 UTC
- Message-ID
- <4AE143BC.7040507@viscovery.net>
- In-Reply-To
- <26ae428a0910221411l73aa7cbak5c060925ccdf4cea@mail.gmail.com>
Howard Miller schrieb:
Show 6 quoted lines
> Actually thinking some more.... I don't understand something about > this. I don't actually want to merge or rebase with anything. I just > want to say "make those commits a series of commits on a branch into > just one commit with a new message". I seriously suspect I'm missing > the point somewhere but what has that got to do with merging or > rebasing?
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
-- Hannes