copy branch name from command line OR the joy of teeny improvements

Kevin McCarthy
Nov 29, 2022

--

One of the real joys of coding is writing silly little things that remove a tiny task.

This one copies the name of the branch to your clipboard from the command line.

I popped it in my .zshrc as I use zsh

#.zshrc

alias copybranch="git branch | grep '^\*' | cut -d' ' -f2 | pbcopy"

No idea if I figured out that one-liner or just found it on StackOverflow but it brings me a little bit of joy every time I use it.

--

--

No responses yet