Gregg H
Gregg H

Reputation: 185

How do I get the hash for my local git sandbox

Forgive my terminology, what I'm calling a sandbox is a local clone of a repository on github. I do a clone of a branch (call it "foo") into a new sandbox on my local system each night. What I'd like to do now is check out a version of my repository identical to what was built a week ago. It seems like I ought to be able to go to my local sandbox for that build and get the hash at the time it was cloned. However, everything I've found talks about getting the hash for the HEAD of "foo". Is there a way to determine the hash of the version that was cloned when my sandbox was created? Thanks, Gregg

Upvotes: 0

Views: 209

Answers (1)

Jeff Puckett
Jeff Puckett

Reputation: 40841

You can use git log to view the commits and go back in time until you see the commit point in which you're interested.

Here's a command that will display the log in an annotated graph with relative timestamps:

git log --graph --format='%C(auto)%h %s%d %Cgreen%ar'

Then checkout that commit hash.

git checkout <SHA>

Upvotes: 1

Related Questions