by 1-more · 2y ago · 0 comments
flog () {
branch="$(
git branch --sort=-committerdate --format="%(committerdate:relative)%09%(refname:short)%09%(subject)" \
| column -ts $'\t' \
| fzf \
| sed 's/.*ago \+\([^ ]*\) .*/\1/'
)"
git co $branch || (
echo -n "git co $branch" | pbcopy
)
}
I have a much longer one for switching between PRs requesting my review and previewing them while I do it.edit: funny story, I went to add 4 spaces to the start of each line and it turns out I did the same thing last time and my autocomplete got it for me which flog | sed 's/^/ /' | pbcopy
gbb() {
eval $(echo git checkout "$(git branch --all \
| fzf --height 10 \
| tr -d '[:space:]' \
| tr -d '*' \
| sed 's/remotes\//\-\-track /g')")
}