Kriem
Kriem

Reputation: 8705

Using git flow, how would I revert back to a previous release?

I'm using git flow for my projects. When a release has been merged into the master branch it is tagged with the release version (e.g. 1.2.0) and deployed to my production servers.

Now I want to quickly revert to the previous release tag (e.g. 1.1.0) as the deployment should not have happened.

Elaboration:

enter image description here

How would I do this?

Upvotes: 14

Views: 17663

Answers (2)

Elbrujodelatribu
Elbrujodelatribu

Reputation: 101

If you want to remove your last commit and its history, you must use git commands:

(git checkout develop)
git reset HEAD^ --hard
git push origin -f

git checkout master
git reset HEAD^ --hard
git push origin -f

This remove the last commit in master and develop and their history, including the tags.

Upvotes: 0

1615903
1615903

Reputation: 34722

Assuming you want to keep the history, but undo the changes the 1.2.0 release did. Use git-revert to create a new commit that reverts everything 1.2.0 did:

git checkout master
git revert HEAD

Upvotes: 9

Related Questions