Break a previous commit into multiple commits

前端 未结 14 2072
渐次进展
渐次进展 2020-12-20 13:09

Without creating a branch and doing a bunch of funky work on a new branch, is it possible to break a single commit into a few different commits after it\'s been committed to

14条回答
  •  暖寄归人
    2020-12-20 13:44

    A quick reference of the necessary commands, because I basically know what to do but always forget the right syntax:

    git rebase -i 
    # mark the targeted commit with 'edit'
    git reset HEAD^
    git add ...
    git commit -m "First part"
    git add ...
    git commit -m "Second part"
    git rebase --continue
    

    Credits to Emmanuel Bernard's blog post.

提交回复
热议问题