Git pull and automatically detect the current branch

Praj Basnet
Nov 26, 2020

Handy little shortcut I use when I run git pull so I don’t have to specify the current branch:

git pull origin $(git rev-parse --abbrev-ref HEAD)

I make this an alias of git pull so that I always get the branch first.