How can I easily fixup a past commit?

前端 未结 12 2338
执笔经年
执笔经年 2020-12-02 03:48

I just read amending a single file in a past commit in git but unfortunately the accepted solution \'reorders\' the commits, which is not what I want. So here\'s my question

12条回答
  •  忘掉有多难
    2020-12-02 04:25

    To fixup one commit :

    git commit --fixup a0b1c2d3 .
    git rebase --autosquash -i HEAD~2
    

    where a0b1c2d3 is commit that you want fixup and where 2 is the number of commits +1 pasted that you want to change.

    Note: git rebase --autosquash without -i doesn't worked but with -i worked, which is strange.

提交回复
热议问题