1

I would like to know if there is any command available to get the SHA id of a particular file on a given specific git branch on the GIT remote server?

Thanks, Srinivas

Srinivas
  • 321
  • 2
  • 5
  • 18

2 Answers2

2

git lsremote is one of the few commands running against a remote repo, as explained in "Show git logs for range of commits on remote server?".
But it will only display SHA1 on refs (tags, branches, ...), not a specific file.

For a file, you need first to fetch the remote repo, and then you can query your information on a specific file.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
0

Thanks for the reply..

I got below command working to meet my scenario for now.. but trying to see if there is any direct command to find the latest ID of a file on remote server...

git log 'branch-name' -- 'file-name'

which displaying log messages with ID, Author and Date.. I am fetching the top first line with unix pipe head command.

git log 'branch-name' -- 'file-name' | head -1

Srinivas
  • 321
  • 2
  • 5
  • 18
  • Please update your question instead of writing additional informations in answer (which it's not) – MBO Jun 14 '11 at 06:59