如何为';git pull';:

如何为';git pull';:,git,Git,我试图创建一个名为springdevelopment的分支,并将代码推送到git git checkout -b springdevelopment git add . git commit -m 'initial commit' git push origin springdevelopment git checkout --track origin/springdevelopment 当我执行git remote show origin时。我在本地分支git pull部分缺少“sp

我试图创建一个名为springdevelopment的分支,并将代码推送到git

git checkout -b springdevelopment 
git add .

git commit -m 'initial commit'
git push origin springdevelopment 
git checkout --track origin/springdevelopment 
当我执行git remote show origin时。我在本地分支git pull部分缺少“spring开发”

你能解释一下发生了什么事,我做错了什么吗

提前感谢您提供的宝贵信息

git checkout -b springdevelopment 
git add .

git commit -m 'initial commit'
git push -u origin springdevelopment 
不需要这样做:

git checkout --track origin/springdevelopment 
以后,您始终可以使用以下工具更新跟踪:

git branch --set-upstream-to origin/springdevelopment
将refspec更新为:

[remote "origin"]
    url = git@github.com:user/project.git
    fetch = refs/heads/*:refs/remotes/origin/*

虽然我认为有一个选项可以让push更新跟踪引用(
refs/remote/…
),但我现在在文档中看不到它的任何痕迹。就打电话

git fetch

按更新后。

我的
git-pull
没有从正确的遥控器中拉出。我意识到我添加了第二个上游
github
,这超过了我的“主”分支

因此,我修改了我的
.git/config
文件:

[branch "master"]
    remote = github
    merge = refs/heads/master
致:


感谢Adam的快速回复。我想让我的springdevelopment分支在git pull部分也可见。当我执行git remote show origin时,结果是gitpull缺少springdevelopment分支,那么您可能想做的是更新refspec:
git fetch refs/heads/*refs/remotes/origin/*
,看看您想要做什么
git branch-a
(在按照Adam的建议设置跟踪之后)为什么我们要这样做“连接被中止“例外。。。。致命:远程端意外挂断致命:远程端意外挂断正如adam的回答所建议的,您错过的是带有git push命令的-u标志-u向上游移动。或者,您可以显式地执行
git分支——将上游设置为=origin/springdevelopment-springdevelopment
。通过这种方式,本地分支被称为“跟踪”远程分支,因此您可以执行
git pull
以在以后合并
[branch "master"]
    remote = origin
    merge = refs/heads/master