Gitのブランチの切り替え(checkout)履歴をpecoる
pecoとかxargsとかawkはきっとみんなインストール済みだと思うけど、まだの人はインストールするといいと思う。
fishでしか確認してないけど普通にどのシェルでも動くんじゃないかな。
develop/master は表示除外してるけどそのへんはお好みでどうぞ。
git --no-pager reflog | awk '$3 == "checkout:" && /moving from/ {print $8}' | grep -vE '(develop|master)' | uniq | head -n 20 | peco | xargs git checkout
aliasを適当に設定してね。ぼくは gitcohistory
にしてる。
~/.config/fish/config.fish
alias gitcohistory='git --no-pager reflog | awk \'$3 == "checkout:" && /moving from/ {print $8}\' | grep -vE \'(develop|master)\' | uniq | head -n 20 | peco | xargs git checkout'
追記
.gitconfig
にセットしたほうがキレイだったのでそうした
.gitconfig
[alias]
co-history = "!git --no-pager reflog | awk '$3 == \"checkout:\" && /moving from/ {print $8}'" | grep -vE '(develop|master)' | uniq | head -n 20 | peco | xargs git co
参考: http://qiita.com/karupanerura/items/502833d970a7cf93ed96
Author And Source
この問題について(Gitのブランチの切り替え(checkout)履歴をpecoる), 我々は、より多くの情報をここで見つけました https://qiita.com/takyam/items/b83402b4354132902d96著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .