The git rebase -i can do this and more. This team is extremely powerful, so it's good to make friends with it.
Syntax: git rebase -i <commit ID> . This calls your text editor with parameters (and instructions) to change all commits to (not including) the given identifier.
For example, to change the previous 5 commits, you can do this:
git rebase -i HEAD~5
Or, if your SVN branch is called "svn / trunk", then this syntax is good too:
git rebase -i svn/trunk
Then a text editor window will appear. To crush everything, change the first word of each line after the first from "pick" to "squash" (if that sounds confusing - it will make more sense when you see it). Then save and close the editor. You will then have the opportunity to edit the commit message for the compressed commit.
Other things you can do with git rebase -i are reordering commits, dispensing commits in different ways, and deleting commits.
I constantly use this command; this is a git killer feature.
andy Oct 02 '08 at 18:01 2008-10-02 18:01
source share