The Pragmatic Ball boy

iOSを中心にやってる万年球拾いの老害エンジニアメモ

git2.19以降のbranchのsort

gitの2.19がリリースされました

Highlights from Git 2.19 | The GitHub Blog

個人的な目玉機能はbranchのsortが楽になったという点です。

git branch --sort=-authordate

とすると更新日順にbranchが表示されます。

更に

git config --global branch.sort -authordate

というふうにconfigに設定しておくと毎回オプションをつけなくてもgit branchするだけで更新日順に表示されます。

authordate以外には以下のようなsort optionが用意されています。

オプション 説明
--sort=numparent shows merges by how awesome they are
--sort=refname sorts branches alphabetically by their name (this is the default, but may be useful to override in your configuration)
--sort=upstream sorts branches by the remote from which they originate