您当前的位置: 首页 > 学无止境 > 心得笔记 网站首页心得笔记
18 怎样把间隔的几个commit整...
发布时间:2020-07-18 12:46:22编辑:雪饮阅读()
先看看我们目前的log
那么这里我将3和1合并 则我们变基命令参数中commit的id就是1的id
git rebase -i a9ef65b42
1这个版本我们添加在最顶上并且message是可以不用写的
然后我们要将3这个版本放在1的下面,即将3移动到1下面,移动之后还要将移动之后的pick修改为s,毕竟是合并嘛,那么就有了。
保存后可能会提示如下
xy@DESKTOP-BG9HNHK MINGW64 ~/Desktop/web/we5 (master)
$ git rebase -i a9ef65b42
interactive rebase in progress; onto a9ef65b
Last command done (1 command done):
pick a9ef65b
Next commands to do (2 remaining commands):
squash 2499cf4 3.txt
pick 4da498c 2.txt
(use "git rebase --edit-todo" to view and edit)
You are currently rebasing branch 'master' on 'a9ef65b'.
(all conflicts fixed: run "git rebase --continue")
nothing to commit, working tree clean
The previous cherry-pick is now empty, possibly due to conflict resolution.
If you wish to commit it anyway, use:
git commit --allow-empty
Otherwise, please use 'git cherry-pick --skip'
Could not apply a9ef65b...
这里最重要的是这句提示,那么我们就执行该命令吧。
这里只需要写下本次合并的理由备注即可。
备注填写后再次执行成功则如
xy@DESKTOP-BG9HNHK MINGW64 ~/Desktop/web/we5 (master|REBASE 1/3)
$ git rebase --continue
[detached HEAD a4761f0] bolixin 1.txt
Date: Sat Jul 18 12:26:51 2020 +0800
2 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 1.txt
create mode 100644 3.txt
Successfully rebased and updated refs/heads/master.
然后我们再来看看版本,会发现1与3被合并了,而中间的2仍旧在
关键字词:间隔,commit,git,不连续,整合,合并