有开发主分支main_branch, 自己做开发时,git checkout -b local_branch main_branch.
在local_branch上git cherry-pick了好几个commit,想要把这几个commit作为一次提交,提交到main_branch上,应该怎么做?
$ git fetch local_branch
$ git checkout -b squash_commit local_branch
$ git branch squash_commit
$ git cherry-pick <Fix 1>
$ git cherry-pick <Fix 2>
$ git cherry-pick <Fix …>
$ git cherry-pick
$ git checkout local_branch //切回到local_branch
$ git merge --squash squash_commit //从squash_commit进行squash merge
$ git commit
$ git push