I've got a script that needs to quickly gather the output of 'git describe' on a specific branch of a remote git repository, in order to set an environment variable.
The obvious way to do that would be to do a 'git clone' to download the repository, then cd into the created git repository folder and do a
export GIT_DESCRIBE_STR=`git describe`
... but I don't really like that approach, because it has so much overhead; in particular, the 'git clone' command would download hundreds of megabytes of git repository data every time it runs, just to run the git describe
command once; and after that the downloaded data would not be used.
My question is, is there any way to run 'git describe' on a remote repository? Something equivalent to this, which of course doesn't work because I just made it up:
git describe --repository=https://my.server.com/r/myproject/myproject.git --branch=master