github 使用相关问题

Git: There is no tracking information for the current branch.

在执行git pull的时候,提示当前branch没有跟踪信息:

git pull
There is no tracking information for the current branch.
Please specify which branch you want to merge with.

对于这种情况有两种解决办法,就比如说要操作master吧,一种是直接指定远程master:

git pull origin master

另外一种方法就是先指定本地master到远程的master,然后再去pull:

git branch --set-upstream-to=origin/master master
git pull

fatal: refusing to merge unrelated histories

  • git pull 失败 ,提示:fatal: refusing to merge unrelated histories

其实这个问题是因为 两个 根本不相干的 git 库, 一个是本地库, 一个是远端库, 然后本地要去推送到远端, 远端觉得这个本地库跟自己不相干, 所以告知无法合并

具体的方法,

第一种方法

  • 从远端库拉下来代码 , 本地要加入的代码放到远端库下载到本地的库, 然后提交上去

第二种方法:

使用这个强制的方法

git pull origin master --allow-unrelated-histories
  • git pull 后面加上 --allow-unrelated-histories , 把两段不相干的 分支进行强行合并
  • 如果继续出现:
Automatic merge failed; fix conflicts and then commit the result.
  • 便在编辑器上面手动的解决冲突
发布了18 篇原创文章 · 获赞 0 · 访问量 351

猜你喜欢

转载自blog.csdn.net/msaker/article/details/102731493