How to reset or revert a file to a specific version

0 votes

Hi Team,

I made some changes in a file in Git repository. But because of some reasons I want to revert or reset to the previous version of that file. How to do that?

Dec 22, 2020 in Git & GitHub by akhtar
• 38,180 points
53 views

1 answer to this question.

0 votes

Hi@akhtar,

To revert a specific file to that commit, you can use the git reset command. You can think of it as a rollback it points your local environment back to a previous commit.

$ git reset <commit hash> <filename>
answered Dec 22, 2020 by MD
• 95,220 points

Related Questions In Git & GitHub

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,550 points
2,361 views
0 votes
1 answer

How to give a file execute mode permissions in Git?

You can easily do this in one ...READ MORE

answered Aug 6, 2018 in Git & GitHub by Sophie may
• 10,550 points
8,969 views
0 votes
1 answer

How to untrack and remove a deleted file and log when we check git status ?

Hi@Shashi, You can use the git clean command. ...READ MORE

answered Oct 28, 2020 in Git & GitHub by MD
• 95,220 points
1,208 views
0 votes
1 answer

How to unstage a file in Git?

Hi@akhtar, Sometimes we accidentally add files in the ...READ MORE

answered Nov 19, 2020 in Git & GitHub by MD
• 95,220 points
277 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 26, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
1,138 views
+2 votes
1 answer
0 votes
1 answer

How do I go to a particular version of a file in the Git repository?

Hi@akhtar, You can use git checkout <sha1> to check ...READ MORE

answered Jan 5 in Git & GitHub by MD
• 95,220 points
245 views
0 votes
1 answer

How to untrack a file in Git?

Hi@akhtar, You can untrack your file from git ...READ MORE

answered May 4, 2020 in Git & GitHub by MD
• 95,220 points
2,960 views