Reputation: 18338
I have branches master and feature.
Feature has about 20 commits ahead of master.
I want to squash all commits together so when I merge I have one commit. Is there a way to do this with one command? I know I could do an interactive rebase; but I am looking for a command that makes this easy.
Upvotes: 1
Views: 190
Reputation: 11541
You can use
git rebase -i {revision-number}
git rebase --interactive {revision-number}
Where -i
means that you are going to enter into the interactive mode. You specify the revision from which you want the merge to occur.
After entering the interactive mode you will select for the first one the pick
option and for the others squash
. This way you will combine the multiple commits from feature branch into a single one. Then you can do:
git checkout master
git merge feature
Here is a great explanation:
http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html
Upvotes: 0
Reputation: 1010
Yes!
On the master branch:
git merge --squash feature-branch
Upvotes: 4