Nono.MA

Push to the Current Git Branch

AUGUST 21, 2019

# Get name of Git's current branch and push changes to origin
git push origin $(git branch | grep \* | cut -d ' ' -f2)

I use a text expander to expand gpp to this command whenever I'm on Terminal. Instead of expanding to git push origin master this command will push to whatever branch you are in.

# Get name of Git's current branch
git branch | grep \* | cut -d ' ' -f2

GitCode