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,240 points
164 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,380 points

Related Questions In Git & GitHub

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 in Git & GitHub by Kichu
• 19,040 points
127 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,590 points
7,439 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 7, 2018 in Git & GitHub by Sophie may
• 10,590 points
16,974 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 29, 2020 in Git & GitHub by MD
• 95,380 points
8,958 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
2,070 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, 2021 in Git & GitHub by MD
• 95,380 points
654 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,380 points
9,117 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