ItSolutionStuff.com

Git Remove Last Commit from Local Example

By Hardik Savani • November 6, 2024
Git

Git is distributed version control system that is a awesome. when ever you are working with git repository. if you did commit your code in your local system by mistake, then if you want to remove last commit from your project. so let's see following example:

Example Command:

git add .

git commit -m "change for test"

git reset --soft HEAD~

Output:

I hope it can help you...

Tags: Git
Hardik Savani

Hardik Savani

I'm a full-stack developer, entrepreneur, and founder of ItSolutionStuff.com. Passionate about PHP, Laravel, JavaScript, and helping developers grow.

📺 Subscribe on YouTube

We Are Recommending You

How to Remove File from Git Commit Before Push?

Read Now →

How to Delete a Branch form GitHub Repository?

Read Now →

How to Rename Branch Name in Git Command?

Read Now →

How to Switch Branch using Git Command?

Read Now →

How to Create a New Branch on GitHub?

Read Now →

How to Clone Github Repository using Command Line?

Read Now →

How to Ignore Wildcard Files Name in Git using Gitignore?

Read Now →

How to Ignore Folder in Git using Gitignore?

Read Now →

How to Ignore File in Git using Gitignore?

Read Now →

How to Generate and Add SSH Key in Github?

Read Now →

How to Configure Git Username and Email?

Read Now →

Git Remove Last Commit from Local Example

Read Now →