What options do you have if you want to "undo" a feature branch? Let's say you add a new feature supercool-feature
which you finish (merge into development and delete the feature branch) and then it goes into a release. But then your users really dislike this supercool-feature
. How can I undo/rewind/reverse this feature which has been already merged into development and a release?
I'm using SourceTree to do my versioning.
So in our case, when we "finish" a git flow branch, it makes sense to immediately push the branches + tags to the remote instead of having to enter the git flow commands directly. After entering this config, git flow will automatically push the branches on the remote, thus saving extra time and avoiding confusion.
Run this command
git revert -m 1 <sha1 of M>
Explanation
Your situation is about as follows:
A-B-----C---D-M # master \ / X-Y---Z- # supercool-feature
A, B, C and D were in your master branch, X, Y and Z in your feature branch. When you did git merge supercool-feature
Git created a "merge commit" M for you. This commit encloses all commits from your feature branch as well as possible fixes to fix merge conflicts. So if you revert
that one commit, every change from your featurebranch will be gone again.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With