$ ls
file.txt
$ cat file.txt
Hello World!
$ git checkout -b cat
Switched to a new branch 'cat'
Hello.txt
,裡面的內容都是"Hello World!"git add .
跟 git commit
哦!$ vim Hello.txt
$ git add .
$ git commit -m "change on branch cat"
[cat af2b112] change on branch cat
1 file changed, 2 insertions(+), 1 deletion(-)
$ git checkout master
$ vim Hello.txt
$ git add .
$ git commit -m "change on branch master"
[master d5f9a57] change on branch master
1 file changed, 1 insertion(+), 1 deletion(-)
$ git merge cat
Auto-merging Hello.txt
CONFLICT (content): Merge conflict in Hello.txt
Automatic merge failed; fix conflicts and then commit the result.
$ cat Hello.txt
<<<<<<< HEAD
Hello World from master!
=======
Hello World from cat!
>>>>>>> cat
$ vim Hello.txt
$ cat Hello.txt
Hello World from master!
$ git status
On branch master
Your branch is ahead of 'origin/master' by 8 commits.
(use "git push" to publish your local commits)
You have unmerged paths.
(fix conflicts and run "git commit")
(use "git merge --abort" to abort the merge)
Unmerged paths:
(use "git add <file>..." to mark resolution)
both modified: Hello.txt
no changes added to commit (use "git add" and/or "git commit -a")
both modifed
的東西,熟悉的畫面對吧!!$ git add .
$ git commit -m "Final version"
[master 52886cb] Final version
$ git merge cat
Already up to date.
$ git branch -d cat
Deleted branch cat (was af2b112).