$ git checkout -b feature1
Switched to a new branch 'feature1'
Creating a new branch is quick AND simple.
$ git add readme.txt
$ git commit -m "AND simple"
[feature1 2512cfd] AND simple
1 file changed, 1 insertion(+), 1 deletion(-)
$ 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)
Creating a new branch is quick & simple.
$ git add readme.txt
$ git commit -m "& simple"
[master 400b400] & simple
1 file changed, 1 insertion(+), 1 deletion(-)
$ git merge feature1
Auto-merging readme
CONFLICT (content): Merge conflict in readme
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")
(use "git merge --abort" to abort the merge)
Unmerged paths:
(use "git add ..." to mark resolution)
both modified: readme
no changes added to commit (use "git add" and/or "git commit -a")
Git is a distributed version control system.
Git is free software distributed under the GPL.
Git has a mutable index called stage.
Git tracks changes of files.
<<<<<<< HEAD
Creating a new branch is quick & simple.
=======
Creating a new branch is quick AND simple.
>>>>>>> feature1
Creating a new branch is quick and simple.
$ git add readme.txt
$ git commit -m "conflict fixed"
[master 59bc1cb] conflict fixed
$ git log --graph --pretty=oneline --abbrev-commit
* e1bab73 (HEAD -> master) conflict fixed
|\
| * 2512cfd (feature1) AND simple
* | e33428b & simple
|/
* 1f647c4 branch test
* efdb1eb (origin/master) remove test
* cabbafb add test
* 396deb9 git tracks changes1
* b6eb0ee git tracks changes
* 15980f6 understand how stage works
* 1a063f4 understand how stage works 1
* afb5318 append GPL
* 2e7d71a add distributed
* cb101fe wrote a readme file
最后,删除feature1分支:
$ git branch -d feature1
Deleted branch feature1 (was 75a857c).
工作完成。。。。
$ git merge feature1
Updating e1bab73..eb469b8
Fast-forward
readme | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
$git commit -m "conflict fixed1"
On branch master
Your branch is ahead of 'origin/master' by 5 commits.
(use "git push" to publish your local commits)
Untracked files:
gitskills/
nothing added to commit but untracked files present
$ git status
On branch master
Your branch is ahead of 'origin/master' by 5 commits.
(use "git push" to publish your local commits)
Untracked files:
(use "git add ..." to include in what will be committed)
gitskills/
nothing added to commit but untracked files present (use "git add" to track)
$git add ./gitskills/
$git add readme
$git commit -m "conflict fixed1"
[master dc8400f] conflict fixed1
1 file changed, 2 insertions(+)
create mode 100644 gitskills/README.md
$ git status
On branch master
Your branch is ahead of 'origin/master' by 6 commits.
(use "git push" to publish your local commits)
nothing to commit, working tree clean
git log --graph --pretty=oneline --abbrev-commit
* dc8400f (HEAD -> master) conflict fixed1
* eb469b8 (feature1) AND simple2
* e1bab73 conflict fixed
|\
| * 2512cfd AND simple
* | e33428b & simple
|/
* 1f647c4 branch test
* efdb1eb (origin/master) remove test
* cabbafb add test
* 396deb9 git tracks changes1
* b6eb0ee git tracks changes
* 15980f6 understand how stage works
* 1a063f4 understand how stage works 1
* afb5318 append GPL
* 2e7d71a add distributed
* cb101fe wrote a readme file
$ git branch -d feature1
Deleted branch feature1 (was eb469b8).