3 回答

TA貢獻1864條經驗 獲得超2個贊
使用--sort=-committerdate選項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
高級用法:
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貢獻1963條經驗 獲得超6個贊
git分支名稱列表,按最新提交順序排序…
擴展Jakub的答案和Joe的技巧,以下內容將去除“ refs / heads /”,因此輸出僅顯示分支名稱:
命令:
git for-each-ref --count=30 --sort=-committerdate refs/heads/ --format='%(refname:short)'
結果:
- 3 回答
- 0 關注
- 1864 瀏覽
添加回答
舉報