I am relatively new to Git and I want to know if this is correct to do and if there are other ways to remove a feature branch which is merged to master branch. Let me explain with a example:
Let us assume we are working on three tickets (bugs/enhancements) and there are three feature branches one for each ticket each branched off from the Tag v2.0.21. After the development work is done on each ticket, and after sufficient testing, we merge it to the master branch and label this branch as say v2.0.22 and release it to production.
Right after the production release, let us say we figured out one of the ticket (Ticket2) is failing and should be removed. This is what I've in mind and I wanted to know if this is a good approach to remove the commits associated with Ticket2.
Like say,
I hope someone can help me validate this approach and suggest better ways to remove a feature branch that is already merged to master. Thanks!
If your merges create a "merge commit", which is often a good idea for this very reason, then you can reverse the changes from a specific feature branch by using the git revert
command with the commit ID of the merge commit for that branch.
The Git documentation includes a detailed note on how to revert a faulty merge which has more information that you may find useful.
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