How To Undo Merge Git Code Example


Example 1: undo a git merge


git reset --hard HEAD~1
git reset --hard <commit_sha>

Example 2: git revert merge


git revert -m 1 <merge-commit>

Example 3: git undo merge


git reset --hard HEAD~1

Example 4: cancel a merge git


git merge --abort

Example 5: revert last merge git


git revert -m 1 commit_hash

Example 6: undo merge


// find the commit hash
git log --oneline

git revert -m 1 [commit-hash]

// https://www.datree.io/resources/git-undo-merge

Comments

Popular posts from this blog

Converting A String To Int In Groovy

"Cannot Create Cache Directory /home//.composer/cache/repo/https---packagist.org/, Or Directory Is Not Writable. Proceeding Without Cache"

Android How Can I Convert A String To A Editable