Git分支没有跟踪信息 [英] Git branch no tracking information

查看:722
本文介绍了Git分支没有跟踪信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在git pull后,我得到这个输出。

 当前分支没有跟踪信息。 
请指定您想要合并的分支。
详情请参阅git-pull(1)

git pull< remote> <分支>

如果你想为这个分支设置跟踪信息,你可以这样做:

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

问题是我创建了该分支,并且在该分支上完成了提交的提示音并切换到其他分支和回到这一个。



我的问题是不是如何解决这个问题我想知道是什么原因造成的以及如何防止它再次发生。

解决方案

这是因为您没有设置上游(其中指的是你想跟踪哪个远程分支)。

设置跟踪远程分支:



如果本地分支是在本地机器上创建的,那么当您推送到远程时,可以使用 -u / - 当你执行 git push



时,set-upstream 那么当你执行 git checkout 时,你可以使用 - track 选项。



为了解决这个问题(设置一个远程追踪分支),只需要做一下git告诉你的事情:

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


After git pull I get this output.

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> my_branch

Problem is that I have created that branch and have done tones of commits on this branch and switching to other branches and getting back to this one. Than a new user added few commits and after that I am getting this message.

My question is not how to fix this I want to know what cause this and how to prevent it from happening again.

解决方案

This is because you didn't set the upstream (which means which remote branch you want to track).

To set the tracking remote branch:

If the local branch is created in your local machine, then when you push to the remote, you could use -u/--set-upstream option when you do git push.

If the branch is checked out from a remote branch, then you could use --track option when you do git checkout.

To fix this(set a remote tracking branch), just do what git tell you:

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

这篇关于Git分支没有跟踪信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆