Undo git merge of master into feature
I have two branches: Master and Feature.
I made some changes to Master and wanted to copy them into Feature. So I merged Master into Feature. Apparently, that was the wrong thing to do because now prior changes to Feature appear in Master.
- Shell Script On Git Merge Commit
- Using git rebase and git merge to set up a good team workflow
- Failed merge in EGit
- Git subtree merge removes changes in branch being merged to
- How to merge or rebase in git when the directory structure changed?
- How to manage git merge with essentially two masters?
What I expected: A - B - - - - E - G [master] \ \ C - D - - F - H [feature] What it looks like now: G [master] / A - B - C - D - E - F - H [feature]
Here’s the fun part: I merged Master into Feature twice before noticing the problem, and I’ve made additional commits to both branches. How do I undo the merges or make it so Master is unaffected by Feature’s commits?
One Solution collect form web for “Undo git merge of master into feature”
Given the tree you drew in your question, you want to undo commits C, D, and F from master. To accomplish this, from the command prompt type:
git checkout master git revert C git revert D git revert F