How to split last commit into two in Git

前端 未结 10 509
囚心锁ツ
囚心锁ツ 2020-12-07 06:23

I have two working branches, master and forum and I\'ve just made some modifications in forum branch, that I\'d like to ch

10条回答
  •  失恋的感觉
    2020-12-07 07:15

    Run git gui, select the "Amend last commit" radio button, and unstage (Commit > Unstage From Commit, or Ctrl-U) changes that you do not want to go into first commit. I think that's the easiest way to go about it.

    Another thing you could do is cherry-pick the change without committing (git cherry-pick -n) and then either manually or with git gui select desired changes before committing.

提交回复
热议问题