Skip to content
Fix Code Error

Go to particular revision

March 13, 2021 by Code Error
Posted By: Anonymous

I cloned a git repository of a certain project. Can I turn the files to the initial state and when I review the files go to revision 2, 3, 4 … most recent? I’d like to have an overview of how the project was evolving.

Solution

Before executing this command keep in mind that it will leave you in detached head status

Use git checkout <sha1> to check out a particular commit.

Where <sha1> is the commit unique number that you can obtain with git log

Here are some options after you are in detached head status:

  • Copy the files or make the changes that you need to a folder outside your git folder, checkout the branch were you need them git checkout <existingBranch> and replace files
  • Create a new local branch git checkout -b <new_branch_name> <sha1>
Answered By: Anonymous

Related Articles

  • Checkout another branch when there are uncommitted changes…
  • What's the difference between "git reset" and "git…
  • How do I make a Git commit in the past?
  • Retrieve specific commit from a remote Git repository
  • Git Using Remote Branch
  • What's the difference between HEAD^ and HEAD~ in Git?
  • git pull while not in a git directory
  • How to remove element from array in forEach loop?
  • How can I move HEAD back to a previous location? (Detached…
  • Why did my Git repo enter a detached HEAD state?

Disclaimer: This content is shared under creative common license cc-by-sa 3.0. It is generated from StackExchange Website Network.

Post navigation

Previous Post:

How to initialize a two-dimensional array in Python?

Next Post:

JavaScript – Replace all commas in a string

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

  • Get code errors & solutions at akashmittal.com
© 2022 Fix Code Error