git 拉取必须调用两次 - 提取后暂停,然后仅执行合并

git pull has to be invoked twice - halts after fetch, then performs only merge

我遇到了与 git pull 命令相关的奇怪行为。似乎它只执行获取并在那之后停止。第二 git 拉更新我的本地分支执行合并。

这是命令的输出:

$ git co develop
Switched to branch 'develop'
Your branch is behind 'origin/develop' by 45 commits, and can be fast-forwarded.
 (use "git pull" to update your local branch)

$ git pull
remote: Counting objects: 7, done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 3 (delta 2), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.

$  git st
On branch develop
Your branch is behind 'origin/develop' by 47 commits, and can be fast-forwarded.
 (use "git pull" to update your local branch)
nothing to commit, working directory clean

$ git pull
Updating f80464f..61ee4c1
Fast-forward
.../i18n/Views.Account.Login.es.resx               |    2 +-
.../i18n/Views.Account.Login.fr.resx               |    2 +-
.../i18n/Views.Account.Login.id.resx               |    2 +-
...here goes list of files

我在 Windows 上使用 git bash,远程 git 服务器是 Atlassian 的 BitBucket。 是什么导致了这种行为?

git co develop

当您从一个分支切换到另一个分支并且已经有人将内容推送到该分支时,您会看到 Your branch is behind 消息

git pull

这尝试提取 origin/develop 参考,但您的分支未与其合并

你需要通过发出这个

来合并你已经拉取的东西

git merge origin/develop

现在更改的分支 developorigin/develop 同步

可能是提取触发了后台垃圾回收,这可能会阻止后续的合并。尝试设置 git config gc.autoDetach false 并查看之后是否发生。