git pull 常见问题

git pull 提示 refusing to merge unrelated histories

解决方法:git pull --allow-unrelated-histories  < 回车后会进入编辑页面,一般直接 q 退出即可 >

 

To push the current branch and set the remote as upstream,意思是推送当前分支并将远程设置为上游

解决方法:git push --set-upstream origin master

git branch --set-upstream-to=origin/<branch> master

Git在本地新建分支后,必须要做远程分支关联。关联目的是如果在本地分支下进行git pull 和 git push操作时 ,不需要指定在命令行指定远程的分支. 推送到远程分支时,没有关联的情况下而且没有指定, git pull 的时候,就会提示你如下信息

MacBook-Pro:projects user$ 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> master

解决方法:git branch --set-upstream-to=origin/master master 

如果本地分支与远程分支同名可以:git branch --set-upstream-to=origin/master

猜你喜欢

转载自www.cnblogs.com/xuey/p/9785749.html