aboutsummaryrefslogtreecommitdiff
path: root/Documentation
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2009-04-07 03:09:39 -0400
committerJunio C Hamano <gitster@pobox.com>2009-04-07 23:22:15 -0700
commit8cae19d987b1bbd43258558f591e39d9d216dcb3 (patch)
tree79e914df66245e75991c066cd3b1c7b59274a88a /Documentation
parent8db9a4b85d6b0d7424c8a19b77a5baa8529ab64c (diff)
downloadgit-8cae19d987b1bbd43258558f591e39d9d216dcb3.tar.gz
git-8cae19d987b1bbd43258558f591e39d9d216dcb3.tar.xz
for-each-ref: add "upstream" format field
The logic for determining the upstream ref of a branch is somewhat complex to perform in a shell script. This patch provides a plumbing mechanism for scripts to access the C logic used internally by git-status, git-branch, etc. For example: $ git for-each-ref \ --format='%(refname:short) %(upstream:short)' \ refs/heads/ master origin/master Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/git-for-each-ref.txt5
1 files changed, 5 insertions, 0 deletions
diff --git a/Documentation/git-for-each-ref.txt b/Documentation/git-for-each-ref.txt
index 5061d3e4e..b362e9ed1 100644
--- a/Documentation/git-for-each-ref.txt
+++ b/Documentation/git-for-each-ref.txt
@@ -85,6 +85,11 @@ objectsize::
objectname::
The object name (aka SHA-1).
+upstream::
+ The name of a local ref which can be considered ``upstream''
+ from the displayed ref. Respects `:short` in the same way as
+ `refname` above.
+
In addition to the above, for commit and tag objects, the header
field names (`tree`, `parent`, `object`, `type`, and `tag`) can
be used to specify the value in the header field.