I know that I can fetch any remote branch to any local branch, but is there also some kind of shortcut to fetch just from the tracked remote branch to the current tracking local
Tying together a few things from the existing answers...
Get the name of the checked out branch:
git rev-parse --abbrev-ref HEAD
To answer your question, how do you fetch only the current branch? Here you go, as an alias called fetchthis
. Use like git fetchthis
.
git config --global alias.fetchthis '!bname=$(git rev-parse --abbrev-ref HEAD); git fetch origin $bname`
Tested in Git for Windows:
$ git --version
git version 2.25.1.windows.1