在本地master分支上新建的Monitor分支pull操作:
若Git服务器上没有Monitor分支:
在本地Monitor分支:
git pull
无法把Git服务器上的master分支的最新文件下拉,提示:
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> Monitor
原因:
Git 服务器上没有对应的分支与本地新分支关联,所以git pull失败
解决方法:
git branch --set-upstream-to=origin/master Monitor
origin/master是 Git服务器上的分支
Monitor是本地新分支
成功:
q@s:~/Documents/Practice/test$ git pull
Username for 'http://**': s**
Password for 'http://s**@**':
Updating 204699a..2720802
Fast-forward
one_branch_1.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
完成这一步,并不代表git push就能直接将本分支的内容更新到服务器master分支。
失败:
git push
fatal: The upstream branch of your current branch does not match
the name of your current branch. To push to the upstream branch
on the remote, use
git push origin HEAD:master
To push to the branch of the same name on the remote, use
git push origin Monitor
成功:
git push origin HEAD:master #########将本地Monitor分支的文件 更新到 Git服务器上的master分支
git push origin Monitor ###########将本地的Monitor分支文件 更新到 Git服务器上的Monitor分支(由于原先Git服务器上是没有Monitor分支,所以Git服务器会自动创建Monitor分支)
转载于:https://blog.51cto.com/13502993/2167305