DEV Community

Discussion on: My Personal Git Tricks Cheatsheet

ivanalejandro0 profile image
Ivan Alejandro

Current branch
alias git-branch="git branch | sed -n -e 's/^\* \(.*\)/\1/p'"

My approach to get the current branch is this:

alias gcb='git symbolic-ref --short HEAD'

(gcb to remind me of Git Current Branch)

I like it more because it uses only git and I don't depend on piping through another app.