-
Notifications
You must be signed in to change notification settings - Fork 0
HOWTO
When you see files in a Pull Request (PR) that should not have changed, you can revert them by following these steps:
-
Select your PR in GitHub Desktop, then Fetch and Pull the latest changes.
-
Right-click the repository and select "Show in Explorer" (or Finder on Mac).
-
Right-click within the folder and select "Git Bash Here".
-
Type the following command and press Enter:
git checkout main -- <path to unwanted change>¹ -
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.
If you have a long list of unwanted changes, you don't have to revert them one by one:
-
Revert a whole directory: Use
git checkout main -- path/to/folder/to reset every file in that folder. -
Wildcards: Use
git checkout main -- *.jsto revert all JavaScript files, orgit checkout main -- src/*.cssfor all CSS files in a specific folder. -
The "Check First" Command: Before reverting, run
git diff main --statto see a summary of exactly which files differ from the main branch. This helps you copy-paste the exact paths you need.