How To Undo A Conflicting Merge in GIT
erics, June 8th, 2021
shell> git merge branch-with-messy-changes
1 2 3 |
Auto-merging myCode.pm CONFLICT (content): Merge conflict in myCode.pm Automatic merge failed; fix conflicts and then commit the result. |
shell> git status
1 2 3 4 5 6 7 8 9 10 11 12 13 |
On branch eric-merge Your branch is up to date with 'origin/eric-merge'. You have unmerged paths. (fix conflicts and run "git commit") (use "git merge --abort" to abort the merge) Changes to be committed: Unmerged paths: (use "git add <file>..." to mark resolution) both modified: myCode.pm |
1 2 |
shell> git merge --abort shell> git status |
1 2 3 4 |
On branch eric-merge Your branch is up to date with 'origin/eric-merge'. nothing to commit, working tree clean |
IMPORTANT NOTE: Previous versions of git used different commands for this operation: Latest version: git merge –abort Older than version 1.7.4: git reset –merge Older than version 1.6.2: git reset –hard