Git: how to melt a commit to another commit?

This question already has an answer here:

  • git: squash/fixup earlier commit 6 answers
  • How to modify a specified commit in git? 10 answers

  • A lot of persons will said to you to do rebase --interactive (which could be the solution) but if you plan to change some lines that had been changed in commits B or C, that will be a hell to use.

    The another solution could be :

  • Create and checkout a branch on commit A
  • Amend the commit A or create a new commit (depend on what sense you give to what you want to do)
  • Checkout the previous branch which is still on commit C
  • Use rebase --onto to rebase only commit B and C on the newly created branch (that you could delete after)
  • 链接地址: http://www.djcxy.com/p/23430.html

    上一篇: 如何修改现有提交中的特定单词?

    下一篇: Git:如何融合提交到另一个提交?