xgqfrms™, xgqfrms® : xgqfrms's offical website of cnblogs! xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

git squash commits All In One

git squash commits All In One

squash commits / git commits 合并

git rebase

# 通过 rebase 命令来完成 2个/多个/n 个 commits 的合并
$ git rebase -i HEAD~2 
# $ git rebase -i HEAD~5
# $ 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.


demo

https://github.com/xgqfrms-GitHub/git-combine-history-commits/pull/2

refs

Github PR 时合并多次提交的 commits All In One

https://www.cnblogs.com/xgqfrms/p/16457911.html



©xgqfrms 2012-2020

www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!

原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!


posted @ 2022-07-10 17:56  xgqfrms  阅读(360)  评论(3编辑  收藏  举报