Showing posts with label Git Hard Reset. Show all posts
Showing posts with label Git Hard Reset. Show all posts

Thursday, September 18, 2025

Git repo - Hard Reset using TortoiseGit

Important Tip: 

Create a Backup Copy (zip file) of your local repo on your machine then . . .

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. ⚠️

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


Step-by-Step Guide


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

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

  3. Select a Commit in the Repo, then Right Click on Reset "master" to this. . .  

  4. 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 Dialog Options select "Hard Reset . . .". 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.

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

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

Example:  Hard Reset to remotes/origin/master

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

Friday, October 13, 2023

git reset --hard origin/master

Procedure for Pulling from Master Repo when you are not able to get a Clean Pull.

Right Click on Repo > Open in Terminal > git reset --hard origin/master


Then as shown below enter git reset --hard origin/master

Windows PowerShell

Copyright (C) Microsoft Corporation. All rights reserved.

Install the latest PowerShell for new features and improvements! https://aka.ms/PSWindows

PS C:\!_projects\Present Power\!_Parts_PPS\lib_altium> git reset --hard origin/master

HEAD is now at 85478f5 rclemmons Changed press fit hole size from 8.2mm to 8.0mm

PS C:\!_projects\Present Power\!_Parts_PPS\lib_altium>