path: root/Documentation/git-ls-remote.txt
diff options
authorMichael Schubert <>2011-05-18 20:06:00 (GMT)
committerJunio C Hamano <>2011-05-18 21:37:46 (GMT)
commita87247731e46255567ec58df940adb697e5b95a8 (patch)
tree97e0132adc9036261df4ad278577c3770b77ebe7 /Documentation/git-ls-remote.txt
parentb602ed7dea968d72c5b3f61ca016de7f285d80ef (diff)
ls-remote: the --exit-code option reports "no matching refs"
The "git ls-remote" uses its exit status to indicate if it successfully talked with the remote repository. A new option "--exit-code" makes the command exit with status "2" when there is no refs to be listed, even when the command successfully talked with the remote repository. This way, the caller can tell if we failed to contact the remote, or the remote did not have what we wanted to see. Of course, you can inspect the output from the command, which has been and will continue to be a valid way to check the same thing. Signed-off-by: Michael Schubert <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'Documentation/git-ls-remote.txt')
1 files changed, 7 insertions, 1 deletions
diff --git a/Documentation/git-ls-remote.txt b/Documentation/git-ls-remote.txt
index c3df8c0..7a9b86a 100644
--- a/Documentation/git-ls-remote.txt
+++ b/Documentation/git-ls-remote.txt
@@ -10,7 +10,7 @@ SYNOPSIS
'git ls-remote' [--heads] [--tags] [-u <exec> | --upload-pack <exec>]
- <repository> [<refs>...]
+ [--exit-code] <repository> [<refs>...]
@@ -36,6 +36,12 @@ OPTIONS
SSH and where the SSH daemon does not use the PATH configured by the
+ Exit with status "2" when no matching refs are found in the remote
+ repository. Usually the command exits with status "0" to indicate
+ it successfully talked with the remote repository, whether it
+ found any matching refs.
Location of the repository. The shorthand defined in
$GIT_DIR/branches/ can be used. Use "." (dot) to list references in