How can I easily fixup a past commit?

前端 未结 12 2302
执笔经年
执笔经年 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:32

    You can avoid the interactive stage by using a "null" editor:

    $ EDITOR=true git rebase --autosquash -i ...
    

    This will use /bin/true as the editor, instead of /usr/bin/vim. It always accepts whatever git suggests, without prompting.

提交回复
热议问题