Git Push无法更新远程分支,本地qas分支领先110次提交
Git推送异常:本地qas分支无法同步到远程
问题详情
本地处于qas分支,执行git status显示该分支领先origin/qas 110次提交,提示使用git push发布本地提交,但执行git push后返回Everything up-to-date,再次执行git status仍显示领先110次提交。
分支协作流程为:将development分支合并到qas,再合并到production;qas和production分支不直接进行开发工作。可接受删除远程qas分支后重新推送本地内容,需解决同步问题。
环境信息
git remote show origin输出
* remote origin Fetch URL: <my git repository>.git Push URL: <<my git repository>.git HEAD branch: master Remote branches: angularUpgrade tracked ctburndownimsidupdates tracked dashboardfix tracked development tracked fiscal_month tracked lee-demo tracked master tracked new_tbx tracked production tracked qas tracked sword-all-scorecards-troubleshoot tracked sword-coe-ct-burndown-troubleshoot tracked sword-coe-health-metric-scorecard-adding-drill-downs tracked sword-coe-health-metric-scorecard-fixing-errors tracked sword-coe-scorecard-troubleshoot tracked sword-ct-battlefield tracked sword-ct-burndown-ims tracked sword-cycle-time-chart tracked sword-data-delivery tracked sword-data-delivery-filter tracked sword-defect-density tracked sword-greg-changes tracked sword-iet-scorecard tracked sword-iet-scorecard-adding-drill-downs tracked sword-ior-charts tracked sword-lob-coe-scorecard-adding-drill-downs tracked sword-lob-program-related-scorecards-troubleshoot tracked sword-on-time-12mo-forecast-mod tracked sword-program-baseline-scorecard tracked sword-rfc-count tracked sword-rfc-count-coe tracked sword-rfc-count-filter tracked sword-rfc-count-integration-redo tracked sword-scorecard-troubleshoot tracked sword-space-rollup-scorecard-adding-drilldowns tracked sword-space-rollup-scorecard-troubleshoot tracked sword-tbx-burndown-add-mappingdata tracked sword-tbx-burndown-change-pdr-cdr-data-source tracked sword-tbx-on-time-updates tracked sword-tbx-summary-data tracked tbx_chart_updates_for_pam tracked Local branches configured for 'git pull': ctburndownimsidupdates merges with remote ctburndownimsidupdates dashboardfix merges with remote dashboardfix development merges with remote development fiscal_month merges with remote fiscal_month lee-demo merges with remote lee-demo master merges with remote master new_tbx merges with remote new_tbx production merges with remote production qas merges with remote qas sword-all-scorecards-troubleshoot merges with remote sword-all-scorecards-troubleshoot sword-coe-ct-burndown-troubleshoot merges with remote sword-coe-ct-burndown-troubleshoot sword-ct-battlefield merges with remote sword-ct-battlefield sword-ct-burndown-ims merges with remote sword-ct-burndown-ims sword-greg-changes merges with remote sword-greg-changes sword-lob-coe-scorecard-adding-drill-downs merges with remote sword-lob-coe-scorecard-adding-drill-downs sword-on-time-12mo-forecast-mod merges with remote sword-on-time-12mo-forecast-mod sword-program-baseline-scorecard merges with remote sword-program-baseline-scorecard sword-rfc-count merges with remote sword-rfc-count sword-rfc-count-filter merges with remote sword-rfc-count-filter sword-rfc-count-integration-redo merges with remote sword-rfc-count-integration-redo sword-tbx-on-time-updates merges with remote sword-tbx-on-time-updates tbx_chart_updates_for_pam merges with remote tbx_chart_updates_for_pam Local refs configured for 'git push': ctburndownimsidupdates pushes to ctburndownimsidupdates (up to date) dashboardfix pushes to dashboardfix (up to date) development pushes to development (up to date) fiscal_month pushes to fiscal_month (up to date) lee-demo pushes to lee-demo (up to date) master pushes to master (up to date) new_tbx pushes to new_tbx (up to date) production pushes to production (up to date) sword-on-time-12mo-forecast-mod pushes to sword-on-time-12mo-forecast-mod (up to date) sword-program-baseline-scorecard pushes to sword-program-baseline-scorecard (up to date) sword-rfc-count pushes to sword-rfc-count (up to date) sword-rfc-count-filter pushes to sword-rfc-count-filter (up to date) sword-rfc-count-integration-redo pushes to sword-rfc-count-integration-redo (up to date) sword-tbx-on-time-updates pushes to sword-tbx-on-time-updates (up to date) tbx_chart_updates_for_pam pushes to tbx_chart_updates_for_pam (up to date)
git branch -v -v输出
QAS efa5756 Merge branch 'development' into QAS ctburndownimsidupdates 03c6cdb [origin/ctburndownimsidupdates] Added IMSID Change order Burndown dashboardfix 41ae4a9 [origin/dashboardfix] Add Excel Export to Q-Notes development 460844b [origin/development] TBx chart updates fiscal_month eb5399d [origin/fiscal_month] Added Excel and images lee-demo 9bb0c36 [origin/lee-demo] I made changes master bd02d98 [origin/master] Initial Push new_tbx 6ac1bc3 [origin/new_tbx] Initial TBX Charts and Tables - Lee production 3d99828 [origin/production: ahead 2] Merge branch 'development' into production * qas 25da205 [origin/qas: ahead 110] Merge branch 'development' into qas sword-all-scorecards-troubleshoot 3f050fc [origin/sword-all-scorecards-troubleshoot: behind 3] Merge branch 'sword-lob-program-related-scorecards-troubleshoot' into sword-all-scorecards-troubleshoot sword-coe-ct-burndown-troubleshoot 5d7777c [origin/sword-coe-ct-burndown-troubleshoot] deleted console.logs sword-ct-battlefield a4682d9 [origin/sword-ct-battlefield] updates to battle field view sword-ct-burndown-ims 2f8d1ac [origin/sword-ct-burndown-ims: ahead 24] Merge branch 'development' into sword-ct-burndown-ims sword-greg-changes 2fa24f1 [origin/sword-greg-changes] FIxed program Selection sword-lob-coe-scorecard-adding-drill-downs b9959b9 [origin/sword-lob-coe-scorecard-adding-drill-downs] Merge branch 'development' into sword-lob-coe-scorecard-adding-drill-downs sword-on-time-12mo-forecast-mod 88edc46 [origin/sword-on-time-12mo-forecast-mod] Merge branch 'development' into sword-on-time-12mo-forecast-mod sword-program-baseline-scorecard f352801 [origin/sword-program-baseline-scorecard] html update sword-rfc-count b49bd19 [origin/sword-rfc-count] Merge branch 'development' into sword-rfc-count sword-rfc-count-filter 9983f7b [origin/sword-rfc-count-filter] Updated sizing sword-rfc-count-integration-redo 8df3b3f [origin/sword-rfc-count-integration-redo] Merge branch 'sword-rfc-count-integration-redo' of <my git repository> into sword-rfc-count-integration-redo sword-tbx-on-time-updates 25cea19 [origin/sword-tbx-on-time-updates] tbx updates tbx_chart_updates_for_pam 460844b [origin/tbx_chart_updates_for_pam] TBx chart updates
解决步骤
先尝试强制推送(无需删除远程分支)
执行以下命令,强制将本地qas分支推送到远程,覆盖远程分支内容:
git push origin qas --force
如果远程分支开启了保护规则导致强制推送失败,再使用下面的删除重建方法。
删除远程qas分支后重新推送
- 删除远程qas分支:
git push origin --delete qas
- 验证远程分支已删除:执行
git remote show origin,查看远程分支列表确认qas已不存在。 - 推送本地qas分支到远程:
git push origin qas
问题原因分析
从git remote show origin的输出可以看到,**Local refs configured for 'git push'**列表中没有qas分支,说明本地qas分支和远程qas分支的推送映射关系出现异常,导致默认执行git push时Git找不到对应的推送目标,因此返回Everything up-to-date但实际未完成推送。
内容的提问来源于stack exchange,提问作者FlyFish
相关产品推荐
相关产品推荐

