# Go back to the last commit that we want to form the initial commit (detach HEAD)
git checkout
# reset the branch pointer to the initial commit,
# but leaving the index and working tree intact.
git reset –soft
# amend the initial tree using the tree from ‘B’
git commit –amend
# temporarily tag this new initial commit
# (or you could remember the new commit sha1 manually)
git tag tmp
# go back to the original branch (assume master for this example)
git checkout master
# Replay all the commits after B onto the new initial commit
git rebase –onto tmp
# remove the temporary tag
git tag -d tmp
http://stackoverflow.com/questions/598672/git-how-to-squash-the-first-two-commits