Use the git command (git reset --hard HEAD) to roll back the version information

Git must know which version the current version is. In Git, it is used to HEADindicate the current version. The previous version is HEAD^the previous version HEAD^^. Of course, it is easier to count 100 ^ in the previous 100 versions HEAD~100.

Now, we want to roll back the current version "A" to the previous version "B", we can use the git reset command:

$ git reset --hard HEAD^	   //HEAD is now at ea34578 B

Of course, you can also query the historical version (each commit will generate a version):

git log --pretty =oneline

Show all submitted version records, select id

Just execute git rest --hard id.

Published 398 original articles · Liked 182 · Visits 370,000+

Guess you like

Origin blog.csdn.net/yexudengzhidao/article/details/105243191