4 ms·
I use something similar along with fzf, so I can search the branch and switch to it. git alias: recent = "!f() { script -q /dev/null git for-each-ref --sort
by girishso 4y ago
I use something similar along with fzf, so I can search the branch and switch to it.
git alias:
recent = "!f() { script -q /dev/null git for-each-ref --sort=-committerdate refs/heads/ --format='%(HEAD)%(color:yellow)%(refname:short)%(color:reset)|%(authordate:short)|%(color:red)%(objectname:short)%(color:reset)|%(subject) (%(color:green)%(committerdate:relative)%(color:reset))'|column -ts'|'; }; f"
zsh function:
grecent() {
local branch=$(git recent | fzf --ansi --no-multi --bind "q:abort")
if [[ "$branch" = "" ]]; then
echo "No branch selected."
return
fi
local branch_name=$(echo "$branch" | awk '{print $1}')
echo "git checkout $branch_name"
git checkout "$branch_name"
}
But sometimes it screws up the terminal and I have to run `reset` to fix. Will be great if someone helps with that.