Using git thread, how do I go back to the previous version?

I am using git thread for my projects. When the release was merged into the main branch, it is marked with the release version (for example, 1.2.0) and deployed to my production servers.

Now I want to quickly return to the previous release tag (e.g. 1.1.0), since the deployment should not occur.

Development:

  • I am merging the 1.2.0 release branch into the main branch.
  • I mark the leading branch with 1.2.0.
  • I push my local repo to the beginning.
  • I came to the conclusion that I released too soon.
  • I want to return to the state of the wizard where it was marked as 1.1.0.
  • I want master @origin to return to state 1.1.0 again.

enter image description here

How can I do it?

+6
source share
1 answer

Assuming you want to keep the story, but discard the changes released in version 1.2.0. Use git-revert to create a new commit that returns everything 1.2.0 did:

git checkout master git revert HEAD 
+2
source

Source: https://habr.com/ru/post/943605/


All Articles