Skip to content
Sander Devisscher edited this page Feb 11, 2026 · 1 revision

Cleanup PRs

When you see files in a Pull Request (PR) that should not have changed, you can revert them by following these steps:

  1. Select your PR in GitHub Desktop, then Fetch and Pull the latest changes.

  2. Right-click the repository and select "Show in Explorer" (or Finder on Mac).

  3. Right-click within the folder and select "Git Bash Here".

  4. Type the following command and press Enter:

    git checkout main -- <path to unwanted change>¹

  5. Commit and push the "changed" files. (This overwrites the files in your branch with the clean versions from the main branch).

¹ This path can be a folder or a specific file. Use ./ and / to specify the path correctly.

💡 Pro-Tip: Handling Multiple Files

If you have a long list of unwanted changes, you don't have to revert them one by one:

  1. Revert a whole directory: Use git checkout main -- path/to/folder/ to reset every file in that folder.

  2. Wildcards: Use git checkout main -- *.js to revert all JavaScript files, or git checkout main -- src/*.css for all CSS files in a specific folder.

  3. The "Check First" Command: Before reverting, run git diff main --stat to see a summary of exactly which files differ from the main branch. This helps you copy-paste the exact paths you need.

Clone this wiki locally