Git解决合并分支冲突
2015-12-19 10:41
459 查看
1. 创建feature1分支
2. 修改readme.txt文件并提交至版本库
3. 切换回master分支
4. 修改readme.txt文件并提交至版本库
5. 合并master和feafure1分支
6. 修改修改readme.txt文件,并提交
7. 查看分支合并情况
$ git checkout -b feature1 Switched to a new branch 'feature1'
2. 修改readme.txt文件并提交至版本库
$ cat readme.txt git is a version control system. git is free software under the GPL. git tracks changes. create a new branch is quick AND sample. $ git add readme.txt $ git commit -m "AND sample" [feature1 36ac3dc] AND sample 1 file changed, 1 insertion(+), 1 deletion(-)
3. 切换回master分支
$ git checkout master Switched to branch 'master' Your branch is ahead of 'origin/master' by 1 commit. (use "git push" to publish your local commits)
4. 修改readme.txt文件并提交至版本库
$ cat readme.txt git is a version control system. git is free software under the GPL. git tracks changes. create a new branch is quick & sample. $ git add readme.txt $ git commit -m "& sample" [master bf81d3e] & sample 1 file changed, 1 insertion(+), 1 deletion(-)
5. 合并master和feafure1分支
$ git merge feature1 Auto-merging readme.txt CONFLICT (content): Merge conflict in readme.txt Automatic merge failed; fix conflicts and then commit the result. $ git status On branch master Your branch is ahead of 'origin/master' by 2 commits. (use "git push" to publish your local commits) You have unmerged paths. (fix conflicts and run "git commit") Unmerged paths: (use "git add <file>..." to mark resolution) both modified: readme.txt no changes added to commit (use "git add" and/or "git commit -a") $ cat readme.txt git is a version control system. git is free software under the GPL. git tracks changes. <<<<<<< HEAD create a new branch is quick & sample. ======= create a new branch is quick AND sample. >>>>>>> feature1
6. 修改修改readme.txt文件,并提交
$ cat readme.txt git is a version control system. git is free software under the GPL. git tracks changes. create a new branch is quick and sample. $ git status On branch master Your branch is ahead of 'origin/master' by 2 commits. (use "git push" to publish your local commits) You have unmerged paths. (fix conflicts and run "git commit") Unmerged paths: (use "git add <file>..." to mark resolution) both modified: readme.txt no changes added to commit (use "git add" and/or "git commit -a") $ git add readme.txt $ git commit -m "conflict fixed" [master 20b4da1] conflict fixed
7. 查看分支合并情况
$ git log --graph --pretty=oneline --abbrev-commit * 20b4da1 conflict fixed |\ | * 36ac3dc AND sample * | bf81d3e & sample |/ * cd7428c new branch dev * b0e9ec8 delete test * 120dab8 add test.txt * 1161148 tracks change * 75fa7b7 append GPL * 85e468e free software * a2de034 git init
相关文章推荐
- iOS崩溃调试的使用和技巧总结
- 决策树
- iBatis中的like的使用
- LeetCode——Search Insert Position
- rpm 工具
- 老翟书摘:《MBA教不了的创富课》
- HackerRank Huffman Decoding(Huffman解码)
- 第一个TCL自定义命令测试通过
- hibernate 中无法成功创建表
- Grub2登录绕过验证漏洞
- opencv cvCreateVideoWriter()参数
- PHP memcached使用
- 《数据挖掘导论》学习
- 时域分析与频域分析
- 让IE6 IE7 IE8 IE9 IE10 IE11支持Bootstrap的解决方法
- Sqlite常用表查询语句
- FireEye 666漏洞
- http方法的在web的实现
- FPGrowth算法理论
- nginx性能优化技巧