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

0 votes
Hi Guys,

I cloned a git repository of a certain project. I want to check the initial code of a file. How to do that?
Jan 5, 2021 in Git & GitHub by akhtar
• 38,230 points

1 answer to this question.

0 votes


You can use git checkout <sha1> to check out a particular commit. Where <sha1> is the commit unique number that you can obtain with the git log command.

$ git checkout <sha1>
answered Jan 5, 2021 by MD
• 95,320 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,110 points
0 votes
0 answers

How to find and restore a deleted file in a Git repository?

Hi Team, I have one Git repository. I ...READ MORE

Dec 22, 2020 in Git & GitHub by akhtar
• 38,230 points
0 votes
1 answer

How to do a re-merge into another branch in git

Seems like you want to rebase your ...READ MORE

answered May 7, 2018 in Git & GitHub by DareDev
• 6,890 points
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,570 points
+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 votes
1 answer
+1 vote
1 answer

How to view the change history of a file using Git versioning?

Hi@akhtar, You can use gitk for this task. ...READ MORE

answered Dec 22, 2020 in Git & GitHub by MD
• 95,320 points
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,320 points