Description
When fetching from a remote, one can specify which ref(s) to fetch.
When pulling, there is even a very convenient convention to fetch and merge the "upstream branch", i.e. the one connected via git branch --set-upstream-to=<remote>/<branch>
.
However, there is no convenient way to specify the name of the current branch, other than typing it out. This is a problem e.g. when working on a multi-platform contribution for the Git project itself, where the upstream branch might be origin/master
, but the contributor needs work on the same branch on multiple machines. In this instance, the branch might need to be updated with git pull --rebase my-fork <current-branch>
.
Let's introduce the --current-branch
option for this, automagically appending the name of the current branch to the commands git fetch
and git pull
, allowing e.g. git pull --rebase --current-branch my-fork
.