By default, show the remote-tracking references that could be pruned.
But if the user specifies --prune=<pattern>, then limit the output to
those matching pattern.  And if the user specified --no-prune, then do
not look for stale remote-tracking references at all.

Signed-off-by: Michael Haggerty <>
 Documentation/git-remote.txt | 6 ++++++
 builtin/remote.c             | 3 +++
 2 files changed, 9 insertions(+)

diff --git a/Documentation/git-remote.txt b/Documentation/git-remote.txt
index 9cbc986..dd48474 100644
--- a/Documentation/git-remote.txt
+++ b/Documentation/git-remote.txt
@@ -147,6 +147,12 @@ error.
 Gives some information about the remote <name>.
+With `--prune`, display stale remote-tracking branches that no longer
+exist on the remote (this is the default).  With `--prune=<pattern>`,
+only report stale references whose names match <pattern> (this option
+can be used multiple times).  With `--no-prune`, do not report stale
+remote-tracking references at all.
 With `-n` option, the remote heads are not queried first with
 `git ls-remote <name>`; cached information is used instead.
diff --git a/builtin/remote.c b/builtin/remote.c
index e1d43e2..293d82d 100644
--- a/builtin/remote.c
+++ b/builtin/remote.c
@@ -1165,6 +1165,9 @@ static int show(int argc, const char **argv)
        int no_query = 0, result = 0, query_flag = 0;
        struct prune_option prune_option = PRUNE_OPTION_INIT;
        struct option options[] = {
+               { OPTION_CALLBACK, 0, "prune", &prune_option, N_("pattern"),
+                       N_("show prunable remote-tracking branches (matching 
pattern, if specified)"),
+                       PARSE_OPT_OPTARG, prune_option_parse },
                OPT_BOOL('n', NULL, &no_query, N_("do not query remotes")),

To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to
More majordomo info at

Reply via email to