From: Sitaram Chamarty Date: Tue, 10 Feb 2009 05:32:09 GMT Subject: Re: Trouble testing out a patch on a branch new scratch git.git repository Message-ID: In-Reply-To: On 2009-02-09, Brent Goodrick wrote: > To explain what I mean: Yesterday, I had this configuration on my > bg/no-progress branch: > > A---B---C---D (bg/no-progress) > / > ----1-----2----3----4 (master) > > B C and D commits are noisy, > fix-the-white-space-and-conform-to-coding-guidelines type commits. I > want to collapse A through D into one commit called E on that branch > so that I can run git format-patch -M on the result and provide a nice > patch email. I would end up with: > > E (bg/no-progress) > / > ----1-----2----3----4 (master) You want to squash the last 4 patches on the current branch into one? The fastest way, if you don't mind re-typing the commit message for the combined commit, is this: git reset --soft HEAD~4 git commit A kinder, gentler, way is this: (1) type in 'git rebase -i HEAD~4' (2) In the editor that pops up, change the 'pick' on all but the first entry to 'squash' or just 's' and save the file. There won't be any conflicts in this scenario, so don't worry about that. (3) Another editor will pop up showing all 4 commit messages in one edit buffer -- combine the various commit messages however you wish and save the file. Done :-) -- Sitaram