How to revert a design review (pull request)
    • PDF

    How to revert a design review (pull request)

    • PDF

    Article Summary

    It happens to all of us. You sign off on a design review (pull request) and merge the changes, only to learn that not all of the correct changes were merged in.

    This how-to explains how to revert a design review and keep your commits so you can add your additional changes and apply your original changes.

    How to revert

    You may want to stash your changes if you have work-in-progress.

    The first thing you need to do is switch/checkout your local repo to main. The changes were merged from your development branch into your main branch and the main branch is what needs to be reverted.

    If you have TortoiseGit, you can right click on your file explorer and select "Switch/Checkout".
    tortoisegit switch checkout.png

    Select the main branch and click ok to switch to the main branch.
    Screen Shot 2022-08-16 at 5.43.41 PM.png

    Next you want to look at a log of the changes. In TortoiseGit, right click on a file explorer window and select "Show log".
    tortoisegit show log.png

    The log will show the most recent commits. In this example, we have a design review (PR) that merges in three commits. We would like to revert back to the previous merge.
    Screen Shot 2022-08-16 at 5.44.10 PM.png

    Select the merge/commit that you want to revert to. Right click and select "Reset 'main' to this".
    tortoisegit reset main to this.png

    The dialog will show the commit SHA hash.
    Change the reset type to "Hard". This will reset the working tree and index and discard all local changes.
    Screen Shot 2022-08-16 at 5.45.00 PM.png

    Now you need to push your local changes to the server. Using TortoiseGit, right click in the file explorer and select "Push".
    tortoisegit push 3.png

    In the push dialog, change the Options to select "force" or "force with lease", otherwise the push will not go through.
    Screen Shot 2022-08-16 at 5.46.19 PM.png

    Your local files and the remote main branch will now be reverted to the previous state.
    Screen Shot 2022-08-17 at 11.18.54 AM.png

    You can now edit, delete, or add more commits to your development branch and create a new design review (PR) to apply and merge those commits to your main branch.


    Was this article helpful?