search

Home  >  Q&A  >  body text

patch - 如何让多次 git 的提交作为一个补丁输出?

可能我说的不准确,我把我现在的解决方法说一下
1. 创建新分支(设原分支为 master)
git checkout -b dev
2. 进行多次提交
git commit * N times
3. 从 master 再创建一个分支
git checkout master && git checkout -b release
4. 用 squash 命令 git merge dev --squash
并且编辑一下 comment
5. 用 git format-patch 导出补丁
6. 补丁被认可后,删掉 dev,release 分支

我觉得我的方法很麻烦,请问大家建议我怎么做?

迷茫迷茫2809 days ago889

reply all(1)I'll reply

  • 迷茫

    迷茫2017-04-22 09:02:44

    If you want to merge these submissions, you can:

    1. Use git rebase -i [the IDs of the previous commits]
    2. Change pick in front of the first commit to be merged to reword
    3. Change pick in front of other submissions to squash

    In this way, modifying comments and merging submissions are completed at the same time. Then format-patch normally.

    reply
    0
  • Cancelreply