Skip to content

Instantly share code, notes, and snippets.

@plasticine
Created May 16, 2019 04:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save plasticine/0953b7114060c34b5d122cdb48a151dd to your computer and use it in GitHub Desktop.
Save plasticine/0953b7114060c34b5d122cdb48a151dd to your computer and use it in GitHub Desktop.
gcob() {
local format branch branches
format="%(committerdate:relative)\\%(color:green)%(refname:short)%(color:reset)\\%(HEAD)\\%(color:yellow)%(objectname:short)%(color:reset) %(upstream:trackshort)\\%(contents:subject)"
branches=$(git for-each-ref --format="$format" --sort=-committerdate refs/heads/ | column -t -s "\\") &&
branch=$(echo "$branches" | fzf --ansi --height=15 --border) &&
git checkout $(echo "$branch" | awk '{print $4}')
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment