When I do a git pull
in the master branch, git show this message:
There is no tracking information for the current branch.
Please specify which branch you want to merge to.
See git-pull(1) for details.
git pull <remote> <branch>
If you want to set up the tracing information for this branch, you can do it with:
git branch --set-upstream-to=origin/<branch> master
And when I do git push
in the master branch, git show this message:
fatal: The current master branch does not have an upstream branch.
To push the current branch and set the remote as upstream, use
git push --set-upstream origin master
So I do git push --set-upstream origin master
, git show this message:
To <my-server-name>
! [rejected] master -> master (non-fast-forward)
error: failed to push some references to '<my-server-name>'.
help: Updates were rejected because the tip of your current branch is
help: behind its remote counterpart. Integrate remote changes (i.e.
help: 'git pull ...') before pushing again.
help: See 'Note about fast-forwards' in 'git push --help' for details.
Please help me!
You first need to make sure your local branch references the upstream branch by runing:
git branch --set-upstream-to=origin/<branch> master
After that, you'll want to perform git pull
to fetch the missing changes from your upstream branch.
Once you have the changes, you'll be able to perform a git push
, but it's also possible that you'll have to perform a manual merge
in order to resolve any conflicts that arise from the changes you've made and those that were present in the upstream branch.