git - 看不到远程分支,.git/config 有问题吗?

标签 git branch config

出于某种原因,我看不到我的团队进入的新分支,我 99% 确定该分支存在,因为我可以在 Bitbucket 的用户界面中看到它。

我感觉可能是我的 .git/config 文件不对。

此刻我有这个...

[remote "origin"]
    url = git@bitbucket.org:user/project.git
    fetch = +refs/heads/master:refs/remotes/origin/master
    fetch = +refs/heads/testing:refs/remotes/origin/testing
    fetch = +refs/heads/uat:refs/remotes/origin/uat
    fetch = +refs/heads/release-1.9:refs/remotes/origin/release-1.9

我试过“git remote update”和“git fetch origin”,但都无法获取新分支

我记得在这里给这个问题“加注星标”I can't see my remote branch ,并在旧笔记本电脑上将我的配置更改为类似以下内容

git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"

我真的很想知道为什么我的配置文件处于当前状态的根本原因......也许我没有以正确的方式创建分支?

通常在创建新分支时我会做类似的事情

git checkout -b issue-1001

然后下面分享我的分支

git push origin issue-1001

最佳答案

您的fetch refspec 仅获取mastertestinguatrelease-1.9。因此,推送到远程仓库的任何其他分支都将被忽略,并且永远不会被带到您的本地仓库。笔记本电脑上的 refspec:

+refs/heads/*:refs/remotes/origin/*

表示从远程存储库中获取所有 分支,因此您可以看到任何新分支。

简短的形式是,如果你想看到新的分支,那么你需要使用像上面那样的 refspec。

顺便说一句,您创建分支的方式看起来不错。 :-)

关于git - 看不到远程分支,.git/config 有问题吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18205776/

相关文章:

git - MonoTouch 项目/解决方案中的 .gitIgnore 中应包含哪些文件?

git - 将分支 merge 到 Git 中的多个分支

git - Pycharm,git : merge from master into branch

netbeans - 以编程方式更改 Netbeans 内部的颜色?

SSH:仅接受来自本地主机的密码连接

Git checkout : updating paths is incompatible with switching branches

git - 观看 github 推送并自动 pull 到远程

windows - windows下如何创建md文件

git - 本地分支机构与集市?

fortran - Fortran中的配置文件解析器