git rebase高级合并

git提交顺序a,b,c,假设想修改提交b
1.git rebase -i a
2.进入vi界面,把b,c提交的状态从pick变成edit,然后:wq退出
3.开始编辑提交b,此时git的指针已经移到了b,可以git log发现最新提交变成了b,把提交用git commit --amend到b上
4.修改好b后git rebase --continue开始编辑提交c,如果没有对c的修改,直接git rebase --continue,有的话同样用git commit --amend
5.如果在第3步里面提交了与c提交有冲突的文件,会提示有错误,形成冲突文件,解决完冲突git rebase --continue
6.Successfully rebased and updated

rebase界面的指令含义
p, pick = use commit: 直接使用commit 不做任何修改;
r, reword = use commit, but edit the commit message: 使用commit,但是会更改commit 信息;
e, edit = use commit, but stop for amending :使用commit,但是遇到此命令时会停止合并;
s, squash = use commit, but meld into previous commit: 使用commit,但是会合并到前一个commit中;
f, fixup = like “squash”, but discard this commit’s log message:和squash类似,但是会抛弃commit的log信息
x, exec = run command (the rest of the line) using shell:使用shell运行命令
d, drop = remove commit:丢弃commit

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值