git rebase
来源:互联网 发布:python 量化论坛 编辑:程序博客网 时间:2024/06/08 05:59
1 如何修改很早以前的commit信息?
首先要git rebase到需要修改message的那个commit的前1个commit。假设commit id是32e0a87f,运行下面的git rebase命令:
git rebase -i 32e0a87f
在git bash中运行上面的命令后,会弹出编辑框,在编辑框中会分行依次显示以pick开头的这个commit之后的所有commit message。
将需要修改的commit message之前的"pick"改为"reword",点击保存按钮,并关闭编辑框,这时会执行rebase操作。
Rebasing (1/3)
接着会再次弹出编辑框,这次编辑框中只有之前改为"reword"的那个commit message,此时修改commit message的内容,点击保存按钮并关闭编辑框,会继续执行rebase操作。
如果操作成功,会出现如下的提示:
[detached HEAD aa3b52c] Add return url
2 files changed, 1 insertion(+), 3 deletions(-)
Successfully rebased and updated refs/heads/oss.
这样就完成了git commit message的修改,
2 如何合并几个提交为1个提交?
如果有4个提交, 1,2,3,4,想把2,3,4合并为2,就需要 git rebase -i commit-id1,然后编辑框是:
pick commit-2
pick commit-3
pick commit-4
将后两个pick改成squash,然后会弹出编辑框,删掉commit-3和commit-4的信息就行了
3 如何重排提交的顺序?
git rebase -i commit-id,在编辑器里重排pick的顺序
4 如果merge另一个分支的提交为1个提交
git merge --squash another_branch
git commit -m "merge another_branch"
- git- rebase
- git rebase
- git rebase
- git rebase
- git rebase
- git rebase
- git rebase
- git rebase
- git rebase
- Git rebase
- Git Rebase
- git rebase
- git rebase
- git rebase
- git-rebase
- git rebase
- git rebase
- git rebase
- 基于netty的网络聊天室(二)——心跳检测及断线重连
- UITableView中的单元格重用
- socket属性设置
- QQ亿级日活跃业务后台核心技术揭秘
- WindowFrom之ListBox用法
- git rebase
- mysql timeStamp默认值0000-00-00 00:00:00 报错
- XMG CAAnimationGroup动画组
- 树控件
- 计时函数
- 常用类
- WindowFrom之ListBox实例
- hdu 1115 Lifting the Stone【多边形重心】
- linux服务器部署jenkins,让代码定时自动编译