首页 > 解决方案 > 无法获取本地 Git 更改以推送到远程分支

问题描述

我有一个链接到 Azure Repos 的本地 Git 存储库。我有一个 Master、Development 和几个功能分支。我想将所有更改推送到开发分支,然后将其合并到 Master。

问题是我的 git 状态不断从“......最新......”变为“你的分支领先......”。如果我使用 git pull/git push,我的 git status 说一切都很好,但是如果我等待几分钟,git status 说我的分支又在前面了。我不确定我弄坏了什么。

$ git status

On branch development
Your branch is up to date with 'origin/development'.

nothing to commit, working tree clean


$ git status

On branch development
Your branch is ahead of 'origin/development' by 14 commits.
  (use "git push" to publish your local commits)

nothing to commit, working tree clean


$ git branch -avv

  KJG---Initialize-expComputer                921b26b [origin/KJG---Initialize-expComputer] Updated output object
  KJG--Write-expLog                           cb0db50 [origin/KJG--Write-expLog] added test-function
  KJG-Continue-expComputer                    07a6edd [origin/KJG-Continue-expComputer] save
  NewFeature--Get-expADSite                   4c6d991 [origin/NewFeature--Get-expADSite] platyps update
* development                                 c38a0c5 [origin/development: ahead 14] !Deploy 4.1.4
  master                                      2e01d04 [origin/master: ahead 7] Merge branch 'master' of https://<The Azure Repo Path>
  remotes/origin/ARBranch                     7b4f849 removed mandatory bluebeam parameter from init-expComp
  remotes/origin/Development                  6e7b779 !Deploy 4.1.2
  remotes/origin/KJG---Initialize-expComputer 921b26b Updated output object
  remotes/origin/KJG--Write-expLog            cb0db50 added test-function
  remotes/origin/KJG-Continue-expComputer     07a6edd save
  remotes/origin/Master                       c33f046 Merge branch 'development' into Master
  remotes/origin/NewFeature--Get-expADSite    4c6d991 platyps update
  remotes/origin/NewFeature-expPing           2751a6d updated help

标签: gitazure

解决方案


您是否尝试过诸如 git push origin development:development确保将本地development分支推送到的明确方法origin/development

编辑(2020 年 4 月 2 日):请参阅下面关于使用developmentDevelopment作为您的两个分支名称的评论


推荐阅读