Is there a way to find if a commit/sha present on remote Git server without cloning

711 views Asked by At

At the moment I use git ls-remote to check if a some changes are present on Gerrit server. But not all changes are can be checked is way, particularly merges which do not appear in git ls-remote output.

How can I check if a change is present on Git server without cloning the repo. I'm aware git -r --contains can be used from within the repository.

1

There are 1 answers

1
ElpieKay On BEST ANSWER

Since gerrit is among the tags, I assume you are using Gerrit.

For a commit which has been pushed for review (refs/for/foo), you can use gerrit query or Query Changes to check if it's on the server.

For any commit, if you have access to the Gerrit server and you know the repository name, you can use ssh to run git commands (git rev-parse or git log) on the Gerrit repository.

ssh $username@$gerritserver git --git-dir=$path_to_repo.git rev-parse $commit