gpt4 book ai didi

Git 不显示所有分支

转载 作者:行者123 更新时间:2023-12-02 04:18:20 25 4
gpt4 key购买 nike

我的合作开发者在他的远程 gitlab 存储库上做了很多更改: merge 、删除、创建新分支等。

现在我需要处理他刚刚创建的新功能分支。我打开 Gitbash,执行以下操作:

git pull <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="ec8b8598ac8b8598808d8ec289948d819c8089c28f8381" rel="noreferrer noopener nofollow">[email protected]</a>:root/project-name.git
git checkout new-feature

我收到错误:pathspec 'new-feature' 与 git 已知的任何文件都不匹配。

然后我尝试了:

git show-ref

这仅显示两个分支,而它应该至少显示 8 个。我也尝试过 fetch ,但没有任何区别。

文件真的丢失了还是只是没有跟踪新分支?如何将新分支添加到本地工作区?git clone 会解决这个问题还是只会让情况变得更糟?谢谢。

更新:感谢您的帮助,不幸的是,这些建议都不起作用,我不得不删除所有内容,从头开始设置并进行新的 git 克隆。我们查看了错误日志,但没有找到任何线索。我想这只是其中之一。

最佳答案

我知道这是一个旧线程,但我只是偶然发现它,因为我遇到了同样的问题。检查“man git”后,我发现“git fetch”可以解决问题。因此,对于将来可能遇到此主题的任何人:

  1. 前往终端。
  2. 导航至项目目录。
  3. 输入git fetch

正如 git fetch 的描述所述:

Fetch branches and/or tags (collectively, "refs") from one or more other repositories, along with the objects necessary to complete their histories. Remote-tracking branches are updated (see the description of below for ways to control this behavior).

关于Git 不显示所有分支,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32236074/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com