许荣@DESKTOP-A30VNHE MINGW64 ~/Desktop
$ cd learngit
许荣@DESKTOP-A30VNHE MINGW64 ~/Desktop/learngit (featurel)
$ git switch-c featurel
fatal: A branch named 'featurel' already exists.
许荣@DESKTOP-A30VNHE MINGW64 ~/Desktop/learngit (featurel)
$ vi readme.txt
许荣@DESKTOP-A30VNHE MINGW64 ~/Desktop/learngit (featurel)
$ cat readme.txt
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.
creating a new branch is quick.
creating a new branch is quick AND simple.
许荣@DESKTOP-A30VNHE MINGW64 ~/Desktop/learngit (featurel)
$ git add readme.txt
许荣@DESKTOP-A30VNHE MINGW64 ~/Desktop/learngit (featurel)
$ git commit -m "AND simple"[featurel 78fbc22] AND simple
1 file changed,1insertion(+)
许荣@DESKTOP-A30VNHE MINGW64 ~/Desktop/learngit (featurel)
$ git switch main
Switched to branch 'main'
M README.md
许荣@DESKTOP-A30VNHE MINGW64 ~/Desktop/learngit (main)
$ vi readme.txt
许荣@DESKTOP-A30VNHE MINGW64 ~/Desktop/learngit (main)
$ cat readme.txt
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.
creating a new branch is quick.
creating a new branch is quick & simple.
许荣@DESKTOP-A30VNHE MINGW64 ~/Desktop/learngit (main)
$ git add readme.txt
许荣@DESKTOP-A30VNHE MINGW64 ~/Desktop/learngit (main)
$ git commit -m "& simple"[main 4c5020a]& simple
1 file changed,1insertion(+),1deletion(-)
许荣@DESKTOP-A30VNHE MINGW64 ~/Desktop/learngit (main)
$ git merge featurel
Auto-merging readme.txt
CONFLICT (content): Merge conflict in readme.txt
Automatic merge failed; fix conflicts and then commit the result.
许荣@DESKTOP-A30VNHE MINGW64 ~/Desktop/learngit (main|MERGING)
$ git status
On branch main
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: readme.txt
Changes not staged for commit:(use "git add <file>..." to update what will be committed)(use "git restore <file>..." to discard changes in working directory)
modified: README.md
no changes added to commit (use "git add" and/or "git commit -a")
许荣@DESKTOP-A30VNHE MINGW64 ~/Desktop/learngit (main|MERGING)
$ cat readme.txt
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.
creating a new branch is quick.<<<<<<< HEAD
creating a new branch is quick & simple.=======
creating a new branch is quick AND simple.>>>>>>> featurel
许荣@DESKTOP-A30VNHE MINGW64 ~/Desktop/learngit (main|MERGING)
$ vi readme.txt
许荣@DESKTOP-A30VNHE MINGW64 ~/Desktop/learngit (main|MERGING)
$ cat readme.txt
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.
creating a new branch is quick.<<<<<<< HEAD
creating a new branch is quick & simple.=======
creating a new branch is quick AND simple.>>>>>>>creating a new branch is quick and simple featurel
许荣@DESKTOP-A30VNHE MINGW64 ~/Desktop/learngit (main|MERGING)
$ git add readme.txt
许荣@DESKTOP-A30VNHE MINGW64 ~/Desktop/learngit (main|MERGING)
$ git commit -m "conflict fixed"[main ff88e3c] conflict fixed
许荣@DESKTOP-A30VNHE MINGW64 ~/Desktop/learngit (main)
$ git log --graph --pretty=one --abbrev-commit
* ff88e3c (HEAD -> main) conflict fixed
|\
|*78fbc22 (featurel) AND simple
*|4c5020a & simple
|/*96b6e88 (dev) branch test
*9081ffc branch test
*4213cee branch test
*1b7f4b2 first commit
*4e05e40 add xu.txt
*68d82f9 remove test.txt
*6e7a140 add test.txt
* ea4269d add test.txt
* ab02a81 比较没进入工作区与已进入暂存区修改的提交
*153e934 git tracks changes
*3cfa207 understand how stage works
* f74d3f2 append GPL
* ece4da5 add distributed
* ec42fff wrote a file3.txt
*2d29305 wrote a readme file
许荣@DESKTOP-A30VNHE MINGW64 ~/Desktop/learngit (main)
$ git branch -d featurel
Deleted branch featurel (was 78fbc22).
许荣@DESKTOP-A30VNHE MINGW64 ~/Desktop/learngit (main)
$ git log --graph --pretty=one --abbrev-commit
* ff88e3c (HEAD -> main) conflict fixed
|\
|*78fbc22 AND simple
*|4c5020a & simple
|/*96b6e88 (dev) branch test
*9081ffc branch test
*4213cee branch test
*1b7f4b2 first commit
*4e05e40 add xu.txt
*68d82f9 remove test.txt
*6e7a140 add test.txt
* ea4269d add test.txt
* ab02a81 比较没进入工作区与已进入暂存区修改的提交
*153e934 git tracks changes
*3cfa207 understand how stage works
* f74d3f2 append GPL
* ece4da5 add distributed
* ec42fff wrote a file3.txt
*2d29305 wrote a readme file
许荣@DESKTOP-A30VNHE MINGW64 ~/Desktop/learngit (main)
$