less than 1 minute read

Scenario: Wrote code, did a PR, got comments and fixed them. Accidentally started work on a different piece of work but committed change to the same codebase as the previous PR

Fix:

  1. Open cmd
  2. Go to project directory
cd path\to\project
git checkout HEAD~1 \Path\To\File\File.cs

This reverts the file back to the last known copy before your changes were published.

Updated: