ideasman42
ideasman42

Reputation: 48108

How to get the SHA1 for the tip of a branch origin? (without having to switch to it)

How can the SHA1 for the tip of origin be accessed?

For example the local branch may be behind from not being current when git pull runs, or it may not even be checked out.


To give some context, I'm looking to print a log of commits that doesn't depend on the state of my local branches.

Upvotes: 0

Views: 305

Answers (1)

Jamie Starke
Jamie Starke

Reputation: 9234

If you're looking at a branch off the origin called <branch>, then you could use git rev-parse origin/<branch> to get you the sha for the head of the branch.

Upvotes: 2

Related Questions