Git 分支跟踪There is no tracking information for the current branch.

当你执行在develop分支上git pull

返回提示:

bash 复制代码
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> develop

解决办法,即按照提示:

bash 复制代码
git branch --set-upstream-to=origin/develop develop 
#gitbranch 'develop' set up to track 'origin/develop'.
git pull

查看本地分支的远端跟踪分支

要查看本地分支跟踪的远端分支,可以使用git branch命令搭配不同的选项。以下是一些常用的命令及其说明:

  1. 查看所有本地分支及对应的远端跟踪分支:

    bash 复制代码
    git branch -vv

    使用-vv选项可以显示详细的分支信息,包括每个分支的最后一次提交和它所跟踪的远端分支(如果有的话)。

  2. 查看特定本地分支的远端跟踪分支:

    如果你只想查看一个特定分支的远端跟踪分支,可以先切换到那个分支,然后使用git status命令。

    bash 复制代码
    git checkout your-branch-name
    git status

    git status将会显示当前分支的状态,包括它跟踪的远端分支(如果已设置的话)。

  3. 查看配置文件中的跟踪信息:

    你也可以直接查看Git配置文件中关于远端跟踪的信息:

    bash 复制代码
    git config --list | grep branch

    这个命令将列出所有与分支相关的配置,包括本地分支所跟踪的远端分支信息。

以上方法可以帮助你了解本地分支和远端分支之间的关联情况。如果一个本地分支正在跟踪一个远端分支,这意味着当你执行如git pullgit push等命令时,Git知道应该与哪个远端分支进行交互。

相关推荐
泰勒朗斯12 小时前
如何在新机器上设置github完成内容git push
git·github
小妖66618 小时前
git branch -a 还有一些已经删除了的分支
git
&Sinnt&1 天前
Git 版本控制完全指南:从入门到精通
git·后端
Tiny2142 天前
多人协同开发时Git使用命令
git
WebGirl2 天前
代码Revert后再次Merge会丢失的问题
git
小皮侠2 天前
nginx的使用
java·运维·服务器·前端·git·nginx·github
HalukiSan2 天前
如何提交PR
git·gitlab·github
爱莉希雅&&&2 天前
shell编程之awk命令详解
linux·服务器·git
baiyu332 天前
成为git砖家(12): 看懂git合并分支时冲突提示符
git
wu_aceo2 天前
将本地项目提交到Gitee
git·gitee·提交·本地提交·上传git