How to revert a Pull request in git and apply the code changes ?
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 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 server.
The next thing to do is cherry-pick the changes 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 revert the PR code from your development branch and you can continue the deployment process.
Originally posted on Dev.to