Git version fallback

Time:2021-12-30

In the past, if I wanted to remove a function, I would delete it selectively, annotate it selectively, and then view and compare it logically. Every time, after changing these, I always feel so tired!!! Then I found a very powerful function of GIT:RollBACK 。 Of course, I still like to call it:Version fallback


1. git log

  • Definition: this command displays the latest to farthest commit logs. Each submission has a correspondingcommit idandcommit message

    Git version fallback

If you dislike that the output information is disorderly, add–pretty=onelineGive it a try!

Git version fallback

2. git reset –hard id

  • Definition: returns to the specified version according to the ID;
    We have seen all the submitted information according to the GIT log command. In this article, I will go back toPersonal module modification package introduction sequenceVersion, i.ecommit id7222c8f6be2d663982faa98dffe2647966b438b1;
  • effect:

3. git push origin HEAD –force

  • Push to local to remote warehouse: make the remote warehouse code the same as your local version.

At this time, I suddenly found that there was no need to go back. The disappeared code just now had to be found again. Don’t worry, we git are powerful!

4. git reflog

  • Definition: view the history of command operations

    Git version fallback

Find what you want**_ Operation ID * *, Still use the above**_ git reset --hard id_**。 As like as two peas, I return to the same version as the first one.



Recommended Today

Configuration and test of opencvsharp in VS

1. What is opencvsharp Opencvsharp is developed by a Japanese engineer. The project address is: https://github.com/shimat/opencvsharp . It is OpenCV Net wrapper, which is closer to the original opencv than emgucv, and has many sample references. 2. Opencvsharp features It directly encapsulates more opencv methods, reduces the difficulty of learning, and is easier to use […]