Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save daubac402/6ef962f101928039869599ff2547cf91 to your computer and use it in GitHub Desktop.
Save daubac402/6ef962f101928039869599ff2547cf91 to your computer and use it in GitHub Desktop.
Git revert to a previous tag then push to origin:master

Git revert to a previous tag then push to origin:master

There are 2 ways to do that

Reset the HEAD then force push to remote

$ git checkout master
$ git pull
$ git reset --hard tag_ABC
$ git push --force origin master

Make a new revert commit then push to remote (or create a new branch and make a PR)

$ git checkout 1.1.1
$ git diff master > ~/diff.patch
$ git checkout master
$ cat ~/diff.patch | git apply
$ git commit -am 'Rolled back to version 1.1.1'
$ git push origin master
@dlsaldanas
Copy link

nice! thanks man

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment