git branch -v、git branch -vv、git branch -verbose

git文档#

Copy
git branch -v -vv --verbose When in list mode, show sha1 and commit subject line for each head, along with relationship to upstream branch (if any). If given twice, print the name of the upstream branch, as well (see also git remote show <remote>).

翻译说明#

显示每个(本地)分支当前指向的提交记录的哈希值,以及和其上游分支的相对位置(如果有的话)
-v-verbose是一个效果
-vv会显示上游分支的名字

举例#

Copy
$ git branch -vv cyr_branch 689c970 [origin/cyr_branch: behind 2] default * master f1e2810 finally test-mysql e2fa7b9 add .gitignore test-network 0d426ce add .gitignore xu_branch e55fcf1 [origin/xu_branch: ahead 1] debug zfc_branch e4a40a5 [origin/zfc_branch] merge

cyr_branch的上游分支为origin/cyr_branch,前者落后后者2
xu_branch的上游分支为origin/xu_branch,前者领先后者1
zfc_branch的上游分支为origin/zfc_branch,两者同步
test-mysqltest-network没有对应的上游分支
master的上游分支为origin/master,但是没有显示,我猜测是因为这个对应关系是固定的,所以无需显示

组合用法#

-a 显示所有本地及远端分支名#

Copy
$ git branch -a cyr_branch * master test-mysql test-network xu_branch zfc_branch remotes/origin/cyr_branch remotes/origin/master remotes/origin/xu_branch remotes/origin/zfc_branch

-av#

Copy
$ git branch -av cyr_branch 689c970 [behind 2] default * master f1e2810 finally test-mysql e2fa7b9 add .gitignore test-network 0d426ce add .gitignore xu_branch e55fcf1 [ahead 1] debug zfc_branch e4a40a5 merge remotes/origin/cyr_branch 1e63522 cyr remotes/origin/master f1e2810 finally remotes/origin/xu_branch 1c82da3 adjust db remotes/origin/zfc_branch e4a40a5 merge

-avv#

Copy
$ git branch -avv cyr_branch 689c970 [origin/cyr_branch: behind 2] default * master f1e2810 finally test-mysql e2fa7b9 add .gitignore test-network 0d426ce add .gitignore xu_branch e55fcf1 [origin/xu_branch: ahead 1] debug zfc_branch e4a40a5 [origin/zfc_branch] merge remotes/origin/cyr_branch 1e63522 cyr remotes/origin/master f1e2810 finally remotes/origin/xu_branch 1c82da3 adjust db remotes/origin/zfc_branch e4a40a5 merge
posted @   MilesGO  阅读(6545)  评论(1编辑  收藏  举报
编辑推荐:
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· 葡萄城 AI 搜索升级:DeepSeek 加持,客户体验更智能
· 什么是nginx的强缓存和协商缓存
· 一文读懂知识蒸馏
点击右上角即可分享
微信分享提示
CONTENTS