为了补充 torek 的答案,git 2.7(2015 年第四季度)将提供更完整的版本git for-each-ref http://git-scm.com/docs/git-for-each-ref,现在支持--contains
git for-each-ref --contains <SHA1>
See commit 4a71109 https://github.com/git/git/commit/4a71109aa442ba1a7045d36f6b148113c95ffc48, commit ee2bd06 https://github.com/git/git/commit/ee2bd06b0f735a00ce0216ca1d3391b13722d987, commit f266c91 https://github.com/git/git/commit/f266c9163b34ec55e453d27e1ed246d67ee3ced0, commit 9d306b5 https://github.com/git/git/commit/9d306b5a6077f026291df3c4a5968eaf95a92417, commit 7c32834 https://github.com/git/git/commit/7c32834813bd6aee5ce5b2c4131d9f34249bc9e3, commit 35257aa https://github.com/git/git/commit/35257aa01203bae74f9fb856fb02c10c4b3836e6, commit 5afcb90 https://github.com/git/git/commit/5afcb90560586765bf21fb09959a8b4497804639, commit d325406 https://github.com/git/git/commit/d325406ef2f3c819d02ac838fb2a3f8e021d08ae, commit 6841104 https://github.com/git/git/commit/68411046b5067de9c378d1f58313f2fae288286c, commit b2172fd https://github.com/git/git/commit/b2172fdf702426cb4eba093b5504d0a0e9e59746, commit b2172fd https://github.com/git/git/commit/b2172fdf702426cb4eba093b5504d0a0e9e59746, ..., commit b2172fd https://github.com/git/git/commit/b2172fdf702426cb4eba093b5504d0a0e9e59746 (07 Jul 2015), and commit af83baf https://github.com/git/git/commit/af83bafa4867ba16368e58f36e8311e9591e68f4 (09 Jul 2015) by Karthik Nayak (KarthikNayak) https://github.com/KarthikNayak.
(Merged by Junio C Hamano -- gitster -- https://github.com/gitster in commit 9958dd8 https://github.com/git/git/commit/9958dd8685a0a8b3d6ecdd07e35d8ecb22b304a7, 05 Oct 2015)
一些功能来自“git tag -l
" and "git branch -l
“ 已做出
有空 ”git for-each-ref
“以便最终统一
后续实施可以在所有三个之间共享
系列或两个。
* 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
请注意,从 Git 2.13(2017 年第 2 季度)开始,git for-each-ref --no-contains <SHA1>
终于支持了!
See commit 7505769 https://github.com/git/git/commit/75057691beb804e804df21992ae55d50ffc36f92, commit 783b829 https://github.com/git/git/commit/783b829287952ec42bf89d9ca42fc6c51d7d0143, commit ac3f5a3 https://github.com/git/git/commit/ac3f5a346860b824e083c5d305757c3260565475, commit 1e0c3b6 https://github.com/git/git/commit/1e0c3b680c6e7b37fc51bd69a410af01897a4f94, commit 6a33814 https://github.com/git/git/commit/6a338149f623f493525324bc0f8d7bb9257cb840, commit c485b24 https://github.com/git/git/commit/c485b24c427254fe36c2c6cc970519b797abd6bc, commit eab98ee https://github.com/git/git/commit/eab98ee5ab84def96012f115a8e10571c6e24e4e, commit bf74804 https://github.com/git/git/commit/bf748049f53cea3662b02d87cc91d44a0164e588 (24 Mar 2017), commit 7ac04f1 https://github.com/git/git/commit/7ac04f1398c4e854cb585bd289ee4fe921984bbd, commit 682b29f https://github.com/git/git/commit/682b29f90d7e049c24f3821d49599dceb4aeb758, commit 4612edc https://github.com/git/git/commit/4612edc639e8c7c15420960a92efa609e92ab9a7, commit b643827 https://github.com/git/git/commit/b643827b9443deadaa5804998116107953f8b42f (23 Mar 2017), and commit 17d6c74 https://github.com/git/git/commit/17d6c744dc0d5ed4cd0f228da14239ea2654f05b, commit 8881d35 https://github.com/git/git/commit/8881d35cace41604dba72c1b6b5ab5a59e0c2b94, commit b084060 https://github.com/git/git/commit/b084060921d6403164e8dee506de787d017569c3, commit 0488792 https://github.com/git/git/commit/0488792d2e56bfe38be6ea7f5456bd3286c807b8 (21 Mar 2017) by Ævar Arnfjörð Bjarmason (avar) https://github.com/avar.
(Merged by Junio C Hamano -- gitster -- https://github.com/gitster in commit d1d3d46 https://github.com/git/git/commit/d1d3d46146e1256efe8ad2a2bb0dd877a738c07d, 11 Apr 2017)