Last active
November 18, 2021 16:30
-
-
Save pedro-mass/3f9618d385f51f43b26002e5a42ff086 to your computer and use it in GitHub Desktop.
zsh scripts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Interactive way to select branch. Lists out the commits to help pick the right branch | |
gcoo() { | |
is_in_git_repo || return | |
git branch -a --color=always | grep --color=auto --exclude-dir={.bzr,CVS,.git,.hg,.svn} -v '/HEAD\s' | sort | fzf --ansi --multi --tac --preview-window right:70% --preview 'git log --oneline --graph --date=short --color=always --pretty="format:%C(auto)%cd %h%d %s" $(sed s/^..// <<< {} | cut -d" " -f1) | head -'$LINES | sed 's/^..//' | cut -d' ' -f1 | sed 's#^remotes/origin/##' | xargs git checkout | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment