I am on Git version 2.6.3, and get this message when just running
git pull
"There is no tracking information for the current branch."
I was under the impression that git would default to origin and the branch with the same name under the "simple" config.
After some trouble, I discover that the easiest way to configure this is to use the -u option like so:
$ git push -u origin master
then it will say:
"Branch master set up to track remote branch master from origin."
so my question is, why can't we use the -u option with git pull?
$ git pull -u origin master
the -u
option is not recognized on pull, only with push
my question is - is there a good reason for that?
git fetch --all and git pull -all will only track the remote branches and track local branches that track remote branches respectively. Run this command only if there are remote branches on the server which are untracked by your local branches. Thus, you can fetch all git branches.
The git pull command is used to fetch and download content from a remote repository and immediately update the local repository to match that content. Merging remote upstream changes into your local repository is a common task in Git-based collaboration work flows.
Some common reasons include: - You are not logged in to your account: see File > Options. - You may need to log out and log back in to refresh your token. - You do not have permission to access this repository. - The repository is archived on GitHub.
Avoid using git pull , unless you're the sole owner and user of the repository. A git pull works by doing a git fetch followed by a git merge . This is OK if your local branch is in sync with the remote branch.
You can use this command to set the upstream of your current branch
$ git branch --set-upstream-to=origin/master
This way your setting the upstream branch to master by default when pulling and pushing without actually using a push
or pull
command.
Now try to git pull
and it should start gathering everything from your repository and after that it will say it's Already up-to-date
If you have any further questions, I'll be happy to assist.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With