Skip to content

Commit 7f11b48

Browse files
committed
Merge branch 'kn/for-each-branch'
Update "git branch" that list existing branches, using the ref-filter API that is shared with "git tag" and "git for-each-ref". * kn/for-each-branch: branch: add '--points-at' option branch.c: use 'ref-filter' APIs branch.c: use 'ref-filter' data structures branch: drop non-commit error reporting branch: move 'current' check down to the presentation layer branch: roll show_detached HEAD into regular ref_list branch: bump get_head_description() to the top branch: refactor width computation
2 parents d5ef5f5 + aa3bc55 commit 7f11b48

File tree

6 files changed

+211
-366
lines changed

6 files changed

+211
-366
lines changed

Documentation/git-branch.txt

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ SYNOPSIS
1111
'git branch' [--color[=<when>] | --no-color] [-r | -a]
1212
[--list] [-v [--abbrev=<length> | --no-abbrev]]
1313
[--column[=<options>] | --no-column]
14-
[(--merged | --no-merged | --contains) [<commit>]] [<pattern>...]
14+
[(--merged | --no-merged | --contains) [<commit>]] [--sort=<key>]
15+
[--points-at <object>] [<pattern>...]
1516
'git branch' [--set-upstream | --track | --no-track] [-l] [-f] <branchname> [<start-point>]
1617
'git branch' (--set-upstream-to=<upstream> | -u <upstream>) [<branchname>]
1718
'git branch' --unset-upstream [<branchname>]
@@ -231,6 +232,19 @@ start-point is either a local or remote-tracking branch.
231232
The new name for an existing branch. The same restrictions as for
232233
<branchname> apply.
233234

235+
--sort=<key>::
236+
Sort based on the key given. Prefix `-` to sort in descending
237+
order of the value. You may use the --sort=<key> option
238+
multiple times, in which case the last key becomes the primary
239+
key. The keys supported are the same as those in `git
240+
for-each-ref`. Sort order defaults to sorting based on the
241+
full refname (including `refs/...` prefix). This lists
242+
detached HEAD (if present) first, then local branches and
243+
finally remote-tracking branches.
244+
245+
246+
--points-at <object>::
247+
Only list branches of the given object.
234248

235249
Examples
236250
--------

0 commit comments

Comments
 (0)