2 years ago
#216786
Klas Mellbourn
Configure git to always fetch only current branch and master
Is it possible to configure git to, by default, when using git fetch, fetch only the current branch and master from the remote, without explicitly mentioning the current branch name?
I know that I can achieve this exact fetch with this command:
git fetch origin $(git rev-parse --abbrev-ref HEAD) master:master
But I would like to have the same behavior when I run only
git fetch
Is that possible to configure? For instance, by some magic refspec in the .git/config file.
Note that, in the configuration, I don't want to hard code the name of the current branch, and I don't want to use aliases.
git
monorepo
git-fetch
git-refspec
0 Answers
Your Answer