Created
January 12, 2024 16:49
-
-
Save wlizama/023ce899898d47e1be6450d1614223a4 to your computer and use it in GitHub Desktop.
Revert merge commit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ensure you are on the correct branch where the merge commit needs to be undone | |
git checkout main | |
# find the hash of the merge commit that you want to undo | |
git log | |
# Use git revert with the -m option followed by the commit hash to revert the | |
# merge commit. The -m option specifies the mainline parent, which is usually the branch you merged into | |
git revert -m 1 <merge_commit_hash> | |
# push the changes to the remote | |
git push |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment