Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How do I merge a large number of commits in phases of, say, 20 commits at a time?

share|improve this question
add comment

2 Answers 2

up vote 2 down vote accepted

git merge accepts any commit specification, so you can do:

git merge ...
git merge origin/master~60
git merge origin/master~40
git merge origin/master~20
git merge origin/master

or even git merge 357a887 to merge everything up to commit 357a887...

share|improve this answer
add comment

Why would you want to do that? Mashing up the commits just gets rid of the history.

If you really do want to do this, I'd go for "git rebase -i" (interactive rebase), that alows you to go wild rewriting history (reordering commits, smashing them together, delete some, ...). Splitting commits can be done, but it is a bit tricky.

I'd go like:

git branch save # don't want to lose the original accidentally...

git rebase -i HEAD~20 # for last 20 commits

# Edit the offered template at will, minimal help included

# Exiting the editor makes git do as told, it might stop if manual intervention required

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.