Actually, starting with the upcoming git 2.7 (Q4 2015), git for-each-ref
, will support the --no-merged
option, allowing for an easy filter of the merged branches
git for-each-ref --no-merged master refs/heads/
With the doc:
--no-merged [<object>]:
Only list refs whose tips are not reachable from the specified commit (HEAD if not specified).
See commit 4a71109, commit ee2bd06, commit f266c91, commit 9d306b5, commit 7c32834, commit 35257aa, commit 5afcb90, ..., commit b2172fd (07 Jul 2015), and commit af83baf (09 Jul 2015) by Karthik Nayak (KarthikNayak
).
(Merged by Junio C Hamano -- gitster
-- in commit 9958dd8, 05 Oct 2015)
Some features from "git tag -l
" and "git branch -l
" have been made
available to "git for-each-ref
" so that eventually the unified
implementation can be shared across all three, in a follow-up
series or two.
* kn/for-each-tag-branch:
for-each-ref: add '--contains' option
ref-filter: implement '--contains' option
parse-options.h: add macros for '--contains' option
parse-option: rename parse_opt_with_commit()
for-each-ref: add '--merged' and '--no-merged' options
ref-filter: implement '--merged' and '--no-merged' options
ref-filter: add parse_opt_merge_filter()
for-each-ref: add '--points-at' option
ref-filter: implement '--points-at' option
user3265569 proposes in the comments:
I've added some formatting using your suggestion.
git for-each-ref --no-merged master \
--format='%(committerdate:relative),%(authorname),%(refname:short)' \
--sort=committerdate \
| column -t -s ','