How to undo the most recent local commits in Git?

ankur0904

Ankur Singh

Posted on November 24, 2024

How to undo the most recent local commits in Git?

Step 1:

git reset HEAD~ 
Enter fullscreen mode Exit fullscreen mode

Step 2:

# Make the changes as necessary
Enter fullscreen mode Exit fullscreen mode

Step 3:

git add .
Enter fullscreen mode Exit fullscreen mode

Step 4:

git commit -c ORIG_HEAD
Enter fullscreen mode Exit fullscreen mode
đź’– đź’Ş đź™… đźš©
ankur0904
Ankur Singh

Posted on November 24, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related