3 回答

TA貢獻(xiàn)1864條經(jīng)驗(yàn) 獲得超2個(gè)贊
使用--sort=-committerdate選項(xiàng)git for-each-ref;
從Git 2.7.0開始也可用于git branch:
基本用法:
git for-each-ref --sort=-committerdate refs/heads/
# Or using git branch (since version 2.7.0)
git branch --sort=-committerdate # DESC
git branch --sort=committerdate # ASC
高級(jí)用法:
git for-each-ref --sort=committerdate refs/heads/ --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(color:red)%(objectname:short)%(color:reset) - %(contents:subject) - %(authorname) (%(color:green)%(committerdate:relative)%(color:reset))'

TA貢獻(xiàn)1963條經(jīng)驗(yàn) 獲得超6個(gè)贊
git分支名稱列表,按最新提交順序排序…
擴(kuò)展Jakub的答案和Joe的技巧,以下內(nèi)容將去除“ refs / heads /”,因此輸出僅顯示分支名稱:
命令:
git for-each-ref --count=30 --sort=-committerdate refs/heads/ --format='%(refname:short)'
結(jié)果:
- 3 回答
- 0 關(guān)注
- 1886 瀏覽
添加回答
舉報(bào)