2

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 Answer 1

0

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
1
  • Was able to use this on Gerrit mirror but, with Gerrit server I got, fatal: "--git-dir" is not a valid option
    – kanna
    May 27, 2020 at 22:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.