git with the command of

1, submitted

git commit -m "comment" filename


 

2, view the commit log

 


 

 

 


 

3, fall back to a version

git reset --hard [index]

git reset --hard HEAD ~ 3 ----- three steps back

 


 

4, delete the file and retrieve

1, the local library to perform rm command

rm aaa.txt

2, submitted to the command

git commit -m "delete aaa.txt" aaa.txt

3, View log

$ Go reflog

7864c76 (HEAD -> master) HEAD@{0}: commit: delete aaa.txt

6db43a7 HEAD@{1}: commit: new add aaa.txt

71663c9 HEAD@{2}: reset: moving to 71663c9

c92fe1c HEAD@{3}: reset: moving to c92fe1c

09db94e HEAD@{4}: reset: moving to 09db94e

c92fe1c HEAD@{5}: commit: four

71663c9 HEAD@{6}: commit: three

09db94e HEAD@{7}: commit: my second commit

85982fe HEAD@{8}: commit (initial): my first commit new file ggod.txt

4, version rollback

$ git reset --hard 6db43a7

HEAD is now at 6db43a7 new add aaa.txt

 

5, branch

1, View branch command

$ git branch -v

* master 6db43a7 new add aaa.txt

2, create a branch

$ git branch dev20200209

3, branch switching

$ git checkout dev20200209

Switched to branch 'dev20200209'

4, merging branches

1, switching to the branch to be incorporated into

$ git checkout master

2, merge command execution

$ git merge dev20200209

Already up to date.

 

Guess you like

Origin www.cnblogs.com/ts-sd/p/12292636.html