Github PR 时合并多次提交的 commits All In One
作者:互联网
Github PR 时合并多次提交的 commits All In One
git commit -s
GitHub 会帮你把新增的 commits 全部追加到一个未合并 PR 里去(PR 会自动更新)
git add <files>
git commit -s -m "some description here"
git push origin feat-xxx
PR 前合并多个 Commits, 方便 code review ✅
# 通过 rebase 命令来完成 2个/多个 commits 的合并
$ git rebase -i HEAD~2
# $ git rebase -i HEAD~n
# vim 编辑,把最后面的一条/多条 commit 的 `pick` 改成 `s`
`pick` 9b7d63b docs: just for test => `s` 9b7d63b docs: just for test
#
# Commands:
# p, pick = use commit
# r, reword = use commit, but edit the commit message
# e, edit = use commit, but stop for amending
# s, squash = use commit, but meld into previous commit
# s: 使用该 commit, 但是要把它合并到前面一条 commit 中去 ✅
# f, fixup = like "squash", but discard this commit's log message
# x, exec = run command (the rest of the line) using shell
# d, drop = remove commit
#
# These lines can be re-ordered; they are executed from top to bottom.
#
# If you remove a line here THAT COMMIT WILL BE LOST.
#
# However, if you remove everything, the rebase will be aborted.
修改过去的提交记录
# 如果指定提交之后再次指定提交,就会显示提交清单。
# 请在清单里找出要修改的提交,将该行的 “pick” 改成 “edit”,之后保存并退出。
$ git rebase -i <commit>
# 接着,编辑要修改的文件,保存文件之后指定--amend选项,以执行提交。
$ git commit --amend
# 最后,指定--continue选项以执行rebase。
$ git rebase --continue
https://backlog.com/git-tutorial/cn/reference/log.html#sec3
refs
https://www.cnblogs.com/daniel-hutao/p/open-a-pr-in-github.html#六我提交了一个-pr然后遇到了问题-abcdefg
https://backlog.com/git-tutorial/cn/
©xgqfrms 2012-2020
www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!
原创文章,版权所有©️xgqfrms, 禁止转载
标签:PR,git,--,commits,rebase,Github,提交,commit 来源: https://www.cnblogs.com/xgqfrms/p/16457911.html