version control - Comment puis-je obtenir une liste de branches Git, commandée par la plus récente commit

Mots clés : gitversion-controlbranchgit

meilleur 4 Réponses version control - Comment puis-je obtenir une liste de branches Git, commandée par la plus récente commit

vote vote

99

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))' 
[alias]     # ATTENTION: All aliases prefixed with ! run in /bin/sh make sure you use sh syntax, not bash/zsh or whatever     recentb = "!r() { refbranch=$1 count=$2; git for-each-ref --sort=-committerdate refs/heads --format='%(refname:short)|%(HEAD)%(color:yellow)%(refname:short)|%(color:bold green)%(committerdate:relative)|%(color:blue)%(subject)|%(color:magenta)%(authorname)%(color:reset)' --color=always --count=${count:-20} | while read line; do branch=$(echo \"$line\" | awk 'BEGIN { FS = \"|\" }; { print $1 }' | tr -d '*'); ahead=$(git rev-list --count \"${refbranch:-origin/master}..${branch}\"); behind=$(git rev-list --count \"${branch}..${refbranch:-origin/master}\"); colorline=$(echo \"$line\" | sed 's/^[^|]*|//'); echo \"$ahead|$behind|$colorline\" | awk -F'|' -vOFS='|' '{$5=substr($5,1,70)}1' ; done | ( echo \"ahead|behind||branch|lastcommit|message|author\\n\" && cat) | column -ts'|';}; r" 
vote vote

89

git for-each-ref --count=30 --sort=-committerdate refs/heads/ --format='%(refname:short)' 
vote vote

76

git branch -v 
git branch -v --sort=committerdate 
vote vote

66

git for-each-ref --sort=-committerdate refs/heads/ --format='%(committerdate:short) %(authorname) %(refname:short)' 

Questions similaires