It is a very common practice to following the git branching in your project to maintain a stable code base in production by having a development , staging and master branches.
First thing first, always commit your code everytime you make a significant changes in the respective branch. At some point your commit history would look like this. Let us call this branch as feature/cancel-order-buton.
The next thing you do is create a pull request to your development branch, that is it, you are done with your task. Then your usual development process continues and 5 other team members creates PR to development branch as well, at this point we have 6 PRs created including your PR.
Now, you need to remove complete code changes that you did in the development for some reason. If you are using a tool like eg. Bitbucket, you will be able to unmerge your PR easily. Once this is done, a new branch will be created with all the changes removed and then you can merge it back to development branch.
The next thing to do is cherry-pick the changes from the remaining 5 PRs and merge it to development branch
git cherry-pick <commit-id>
Once all the changes from other branches are cherry picked and applied, you have successfully reverted your PR code from your development branch and you can continue the deployment process.
Top comments (0)