I often use the git command git fetch origin master:master
. I want to have an alias so I can just do git ff master
. How can I do this? The only piece I am missing is getting the remote branch name. I know I can do git rev-parse --abbrev-ref master@{u}
to get origin/master
but I just need master
from that.
So I imagine it will be something like git fetch $(git config branch.$1.remote) $(???):$1
and I just need to fill in the ???. Then I can add some error handling.
Related: