git merge vs rebase vs cherry-pick
来源:互联网 发布:数据交换平台 中软 编辑:程序博客网 时间:2024/05/02 00:54
git merge是用来合并两个分支的。
# 将b分支合并到当前分支
git merge b
git merge b
git cherry-pick可以选择某一个分支中的一个或几个commit(s)来进行操作。例如,假设我们有个稳定版本的分支,叫v2.0,另外还有个开发版本的分支v3.0,我们不能直接把两个分支合并,这样会导致稳定版本混乱,但是又想增加一个v3.0 中的功能到v2.0中,这里就可以使用cherry-pick了。
# 先在v3.0中查看要合并的commit的commit id
git log
# 假设是 commit f79b0b1ffe445cab6e531260743fa4e08fb4048b
# 切到v2.0中
git check v2.0
# 合并commit
git cherry-pick f79b0b1ffe445cab6e531260743fa4e08fb4048b
git log
# 假设是 commit f79b0b1ffe445cab6e531260743fa4e08fb4048b
# 切到v2.0中
git check v2.0
# 合并commit
git cherry-pick f79b0b1ffe445cab6e531260743fa4e08fb4048b
git rebase有点类似git merge,但是两者又有不同,打个比方,你有两个抽屉A和B,里面都装了衣服,现在想把B中的衣服放到A中,git merge是那种横冲直撞型的,拿起B就倒入A里面,如果满了(冲突)再一并整理;而git rebase就很持家了,它会一件一件的从B往A中加,会根据一开始放入的时间顺序的来加,如果满了你可以处理这一件,你可以继续加,或者跳过这一件,又或者不加了,把A还原。所以merge适合那种比较琐碎的,简单的合并,系统级的合并还是用rebase吧。
专业的区别请移步到这里合并和衍合
# 合并b
git rebase b
# 处理完冲突继续合并
git rebase --continue
# 跳过
git rebase --skip
# 取消合并
git rebase --abort
git rebase b
# 处理完冲突继续合并
git rebase --continue
# 跳过
git rebase --skip
# 取消合并
git rebase --abort
http://blog.csdn.net/pihizi/article/details/6311291
- git merge vs rebase vs cherry-pick
- git merge vs rebase vs cherry-pick
- git merge vs rebase vs cherry-pick
- git merge vs rebase vs cherry-pick
- merge VS rebase VS cherry-pick
- git rebase / cherry-pick / merge
- git cherry-pick, merge, rebase
- Git Cherry-pick/Git Merge/Git Rebase
- Git push/pull/cherry-pick/merge/rebase
- [cherry-pick, merge, rebase]
- git: Rebase vs Merge
- git merge vs git rebase
- git rebase vs git merge
- Git笔记(三)——[cherry-pick, merge, rebase]
- Git笔记(三)——[cherry-pick, merge, rebase]
- git: fetch vs pull, merge vs rebase
- git rebase vs git merge详解
- git pull vs fetch/rebase/merge
- XMLHttp兼容多种不同版本的浏览器
- ARM9 2410移植之ARM中断原理, 中断嵌套的误区,中断号的怎么来的
- 如何获取iPhone电池的状态和当前的电量
- 提高.net的性能
- 使用Hadoop做K-Means计算的总结
- git merge vs rebase vs cherry-pick
- windows注册表文件
- 游标的定义
- 3.5 伙伴系统------《深入Linux内核架构》笔记
- 不能转换void (_thiscall CMainFrame::*)(void)to LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)
- 读取数据库内容
- Android Sax解析XML文档
- Spring中ClassPathXmlApplicationContext类的简单使用
- RMAN自动备份小记