ls -1 --sort=time .git/refs/heads/ | while read b; do PAGER='' git log -n1 --color --pretty=format:'%C(yellow)%d%Creset - %Cred%h%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset%n' --abbrev-commit $b --; done;
このワンライナーは、新しいものから古いものへと時間でソートされたすべてのローカルブランチを印刷します。各ブランチには、人間が読める形式の日付文字列を使用した最後のコミットがあります。あなたはそれをあなたのに追加することができます.gitconfig
。
リモートブランチの場合、私はこの不気味な解決策を思いつきました:
git ls-remote -h origin | while read b; do PAGER='' git log -n1 --color --pretty=format:'%ct%C(yellow)%d%Creset - %Cred%h%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset%n' --abbrev-commit $( echo $b | cut -d' ' -f1 ) --; done | sort -rn -k1,10 | cut -c11-
編集:私が考えるほど、これは信頼できない可能性があるのではないかと心配しています。なぜなら、ls-remote
常にリモート側に接続しているのに対し、log
そうではないからです。fetch
このコマンドを実行するたびに実行する必要がある場合があります。