Skip to content

Instantly share code, notes, and snippets.

@Buggaboo
Last active February 6, 2025 23:03
Show Gist options
  • Save Buggaboo/671627bcbb763bb6891c110d567f7b78 to your computer and use it in GitHub Desktop.
Save Buggaboo/671627bcbb763bb6891c110d567f7b78 to your computer and use it in GitHub Desktop.
Handy git branch + dialog / zenity
# wean oneself off
alias grep="rg --help | less"
alias find="fd --help | less"
alias wc="tokei --help | less"
alias rm="/bin/rm -i"
# brew install dialog zenity
alias git-branch-zenity='/usr/local/bin/zenity -title "Current branch: $(git branch --show-current)" -text "Select branch from $PWD" -list $(git branch --list | sed "s/*//") | pbcopy'
alias gbz='git-branch-zenity'
alias git-branch-menu='git branch | sed "s/*//" | awk "{print NR, \$0}" | \
xargs dialog --title "Current branch: $(git branch --show-current)" \
--stdout --menu "Select a branch in $PWD" 0 0 0 | \
xargs -I{} sh -c "git branch | sed -n \"\${1}p\"" -- {} | xargs | tr -d "\\n" | tr -d "*" | pbcopy'
alias gbm='git-branch-menu'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment