1. 创建feature1分支
$ 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