Whenever I create a new branch, push it out, then pull to check for updates, I find myself running the following command.
git pull origin branch-name
Then after sometime, I have to run:
git branch --set-upstream-to=origin/branch-name
What if there was someway to tell Git to pull from the branch name by default?
To configure Git to perform a
git pull from the current branch by default, you can use the
git config command to set the
pull.default option. This option determines the behavior of the
git pull command when you don't specify a branch name.
To set the
pull.default option to
current, you can use the following command:
git config --global pull.default current
This will configure Git to always perform a
git pull from the current branch, rather than requiring you to specify the branch name each time you run the command.
Keep in mind that this change will only affect your local Git configuration, and will not affect other users who clone your repository. If you want to share this configuration with others, you will need to communicate the change and ensure that everyone who works on the repository is using the same settings.