On Thursday, December 20, 2012 7:25:19 AM UTC+1, Wei Alex wrote:

> Hi,All:
>     I need to merge multiple special commits to one.Please help me.
>     For example, I have some commits like this:
>     A->B->C->D->E.
>     Some of these were commited by me. I want to select them and merge 
> them to one commit just like A->C->E.The new commit A  include the commit A 
> B and D. 
>     Now I knew one method to merge multiple commits to one.
> *    git resest --soft HEAD^n*
> *    **git commit --amend*
>    BUT this method can just merge the TOP n commit not the special ones.
>    Please tell me how can I finish this work.Thanks.

Rebase interactive is your 

In essence: 

git rebase -i A
# reorder the commits so that the ones you want to squash together are 
right after one another
# squash up the commits

Remember, if you have already shared or published this history you should 
NOT rewrite/rebase it any more. 


Reply via email to