Thursday, September 18, 2025

Git repo - Hard Reset using TortoiseGit

To perform a hard reset on a Git repository using TortoiseGit, you'll use the "Reset" option from the context menu. 

This action discards all uncommitted changes in your working directory and aligns your branch's state with a specific commit. 

Because a hard reset is a destructive action, it's crucial to be certain you want to permanently discard your changes before proceeding. ⚠️


Step-by-Step Guide


  1. Right-Click on your Git-controlled folder to bring up the context menu.

  2. Navigate to TortoiseGit > Reset. This will open the reset dialog box.

  3. In the dialog box, you have two main options to configure the reset:

    • "To commit": This field allows you to specify the target commit to which you want to reset your branch. You can either type the commit hash, branch name, or a tag name directly into the box. Alternatively, you can use the ... button to open the log dialog and select the desired commit visually.

    • "Reset type": From the dropdown menu, select "Hard". This is the key step. Choosing "Hard" will discard all your local changes (staged and unstaged) and move your branch's pointer to the selected commit. The other options, "Soft" and "Mixed," are less destructive and won't be covered here.

  4. Once you've selected the correct commit and chosen "Hard" as the reset type, click "OK".

  5. A confirmation dialog will appear, warning you that this is a destructive operation. Read it carefully to ensure you understand the consequences before clicking "Yes" to proceed.

After clicking "Yes," TortoiseGit will execute the hard reset, and your working directory will be reverted to the state of the selected commit. 

All files that were changed or added since that commit will be permanently deleted from your local copy.