cor@MiWiFi-R3-srv:~$ mkdir test cor@MiWiFi-R3-srv:~$ cd test/ cor@MiWiFi-R3-srv:~/test$ git init Initialized empty Git repository in /home/cor/test/.git/
2. new a file
cor@MiWiFi-R3-srv:~/test$ ls cor@MiWiFi-R3-srv:~/test$ touch r1 cor@MiWiFi-R3-srv:~/test$ vim r1 cor@MiWiFi-R3-srv:~/test$ cat r1 1
3. git add + git commit
cor@MiWiFi-R3-srv:~/test$ git add . cor@MiWiFi-R3-srv:~/test$ git commit . [master (root-commit) d3e3706] First Committer: Cor <cor@MiWiFi-R3-srv.nosure> Your name and email address were configured automatically based on your username and hostname. Please check that they are accurate. You can suppress this message by setting them explicitly: git config --global user.name "Your Name" git config --global user.email you@example.com After doing this, you may fix the identity used for this commit with: git commit --amend --reset-author 1 file changed, 2 insertions(+) create mode 100644 r1 cor@MiWiFi-R3-srv:~/test$ git config --list core.editor=vim core.repositoryformatversion=0 core.filemode=true core.bare=false core.logallrefupdates=true cor@MiWiFi-R3-srv:~/test$ git config --global user.name "Corner" cor@MiWiFi-R3-srv:~/test$ git config --global user.email lz303@126.com cor@MiWiFi-R3-srv:~/test$ git config --list core.editor=vim user.name=Corner user.email=lz303@126.com core.repositoryformatversion=0 core.filemode=true core.bare=false core.logallrefupdates=true cor@MiWiFi-R3-srv:~/test$ git branch * master
4. check -b + add new file
cor@MiWiFi-R3-srv:~/test$ git checkout -b secon Switched to a new branch 'secon' cor@MiWiFi-R3-srv:~/test$ ls r1 cor@MiWiFi-R3-srv:~/test$ touch r2 cor@MiWiFi-R3-srv:~/test$ vim r2 cor@MiWiFi-R3-srv:~/test$ cat r2 1 2 cor@MiWiFi-R3-srv:~/test$ git add . cor@MiWiFi-R3-srv:~/test$ git commit . [secon 488ffd9] Second 1 file changed, 4 insertions(+) create mode 100644 r2 cor@MiWiFi-R3-srv:~/test$ git checkout master Switched to branch 'master' cor@MiWiFi-R3-srv:~/test$ git branch * master secon cor@MiWiFi-R3-srv:~/test$ git merge secon Updating d3e3706..488ffd9 Fast-forward r2 | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 r2
5. repeat setp 4 , till the fivth
#before
cor@MiWiFi-R3-srv:~/test$ git log commit 488ffd9786a6a39276a0b6edcb45b7c22488b7a8 Author: Corner <lz303@126.com> Date: Sat Mar 21 21:41:55 2020 +0800 Second commit d3e37065750dfb0dbceed9221e0617db1570dde2 Author: Cor <cor@MiWiFi-R3-srv.nosure> Date: Sat Mar 21 21:38:19 2020 +0800 First
6.
cor@MiWiFi-R3-srv:~/test$ git log commit 04485d658b7c115bb479c375a09c26e492182286 Author: Corner <lz303@126.com> Date: Sat Mar 21 21:48:09 2020 +0800 Fivth commit 56597be06254cb3f3be10f4c20f45303baf01b0e Author: Corner <lz303@126.com> Date: Sat Mar 21 21:47:10 2020 +0800 Forth commit 6ef22830a8dea5031cc00d9738fdaaa6e1d4b475 Author: Corner <lz303@126.com> Date: Sat Mar 21 21:45:29 2020 +0800 Third commit 488ffd9786a6a39276a0b6edcb45b7c22488b7a8 Author: Corner <lz303@126.com> Date: Sat Mar 21 21:41:55 2020 +0800 Second commit d3e37065750dfb0dbceed9221e0617db1570dde2 Author: Cor <cor@MiWiFi-R3-srv.nosure> Date: Sat Mar 21 21:38:19 2020 +0800 First
7.
cor@MiWiFi-R3-srv:~/test$ cat r1 1 cor@MiWiFi-R3-srv:~/test$ cat r2 1 2 cor@MiWiFi-R3-srv:~/test$ cat r3 1 2 3 cor@MiWiFi-R3-srv:~/test$ cat r4 1 2 3 4 cor@MiWiFi-R3-srv:~/test$ cat r5 1 2 3 4 5
8
cor@MiWiFi-R3-srv:~/test$ git revert 488ffd9786a6a39276a0b6edcb45b7c22488b7a8 [master a465835] Revert "Second" 1 file changed, 4 deletions(-) delete mode 100644 r2
cor@MiWiFi-R3-srv:~/test$ ls r1 r3 r4 r5