Reputation: 1450
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.
Upvotes: 2
Views: 854
Reputation: 6768
You can also use gerrit query, if you are looking for a specific change and have its Changeno,patchset
ssh -p 29418 $username@$gerritserver gerrit query limit:1 is:open project:$project --no-limit --format=JSON --current-patch-set $Changenum,$patchset | jq -r '.currentPatchSet.revision | select( . != null )'
This should return the commit SHA!
Upvotes: 0
Reputation: 30868
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
Upvotes: 0