在我的代码库中,我有一个名为
我一直在
master
的分支和一个名为new
的分支。我一直在
new
上工作,进行提交和推送。现在我决定从new
创建并命名一个新的分支newest
,于是我执行了以下操作:git checkout -b "newest"
分支已成功创建。我添加了一个文件并开始工作。我提交了几次更改。
但是,当我尝试将这个新分支和我的更改推送到origin
时,我遇到了以下错误:
C:\wamp\www\myproj>git push origin
To https://github.com/Imray/Proj.git
! [rejected] master -> master (non-fast-forward)
! [rejected] new -> new (non-fast-forward)
error: failed to push some refs to 'https://github.com/Imray/Proj.git'
hint: Updates were rejected because a pushed branch tip is behind its remote
hint: counterpart. Check out this branch and integrate the remote changes
hint: (e.g. 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
所以,按照说明,我尝试了 git pull
,但是出现了以下情况:
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details
git pull <remote> <branch>
If you wish to set tracking information for this branch you can do so with:
git branch --set-upstream-to=origin/<branch> newest
我卡住了。
我该如何将我的新分支和更改推送到 github
?