How to cancel a local git commit

0 votes

Hi Guys,

I have one local goit repository. And I have committed one change in the file. Now I want to cancel the commit. How to do that?

Jan 4, 2021 in Git & GitHub by akhtar
• 38,230 points
404 views

1 answer to this question.

0 votes

Hi@akhtar,

You just need to use the git reset command with the commit ID where you want to move.

$ git reset HEAD~1
answered Jan 4, 2021 by MD
• 95,440 points

Related Questions In Git & GitHub

0 votes
2 answers

How to view the nested workflow of a local git repository?

The closest way to view branches in ...READ MORE

answered Aug 2, 2019 in Git & GitHub by Sirajul
• 59,230 points
1,318 views
0 votes
1 answer

How to solve the ‘Git commit -a error’?

This happens when no editor is set. ...READ MORE

answered Jul 5, 2018 in Git & GitHub by Tyrion anex
• 8,700 points
2,043 views
0 votes
1 answer

How to forcefully commit a file to Git even if the file is ruled as unchanged?

This is simple, just follow the below ...READ MORE

answered Jul 11, 2018 in Git & GitHub by Sophie may
• 10,610 points
12,558 views
0 votes
0 answers

How do I use git reset --hard HEAD to revert to a previous commit

When I revert this commit: git reset --hard ...READ MORE

May 15, 2022 in Git & GitHub by Kichu
• 19,050 points
609 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
3,514 views
+2 votes
1 answer
0 votes
1 answer

How to revert a Git repository to a previous commit?

Hi@akhtar, This depends a lot on what you ...READ MORE

answered Dec 21, 2020 in Git & GitHub by MD
• 95,440 points
676 views
0 votes
1 answer

How to list all the files in a commit in Git?

Hi@akhtar, Using git diff-tree is considered as a preferred way ...READ MORE

answered Dec 22, 2020 in Git & GitHub by MD
• 95,440 points
758 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP