0

Is it possible to download a specific revision/version of file, using Change ID ?

Change Id [generated by commit message hook].

We’ve been using SVN and have recently migrated to GIT, in SVN we used to have an export option, where we could mention the revision id and could download files specific to that revision. I am looking for a similar feature here.

I don't want to download all changes in a branch just one specific file which matches the Change Id I am providing. Can do this in a web interface [gitweb], but want to do it via gitbash, as the intention is to make it part of a script.

Got something like below while i was looking for an answer to this question

git show HEAD~6:./ant-apache.log4j.1.6.5.xml > /c//ant-apache.log4j.1.6.5.xml

or

git show commit_id > C:\TestGit\test.xml

but can I do the same providing a change Id

1 Answers1

1

You can get the commit hash for a specific Change-Id with

git log --grep="Change-Id: 42" --format=format:%h

after that you can use the commands you already discovered.

Johannes Thorn
  • 902
  • 6
  • 13
  • Thanks Johannes, this command is fetching commit id. But the command I mentioned above is not working as expected. $ git show 0311b27 commit 0311b27da01c4d7a4ccbe8e773aa08d49c5a2cb4 Author: XXXXXXXXX Date: Thu Dec 10 13:47:20 2015 +0000 RELEASE: RELEASE-R15.3|CR:89486|ACTION:Modified|DETAILS: Updated RM10646 Change-Id: I0c1bcfd6a91765add98186da144dca853236bb82 Is there an alterantive to download/export file, from the below post which although is from 2010 it seems it won't work. http://stackoverflow.com/questions/3697707/how-do-i-download-a-specific-git-commit-from-a-repository – Blesson Mathew Dec 15 '15 at 14:49
  • Its working fine, the git show syntax i was using was not correct.. with below syntax its working now --------------- git show 0311b27:./RN/VDFUK_SIE_R15.3_10646.xls > /d/ReleaseFolder/GitTest/VFUK_SIE_R15.3_10646.xls – Blesson Mathew Dec 15 '15 at 15:52