没有不值得去解决的问题,也没有不值得去学习的技术!

TortoiseGit Pull Fails: Some Local Refs Could Not Be Updated

Upon closer inspection of the message, I found: error: cannot lock ref 'refs/remotes/origin/sc/fix/to-be-merged-table-scroller': 'refs/remotes/origin/sc/fix' exists; cannot create 'refs/remotes/origin/sc/fix/to-be-merged-table-scroller'

1. When pulling in TortoiseGit, an error occurred: error: some local refs could not be updated; try running ‘git remote prune origin’ to remove any old, conflicting branches. As shown in Figure 1

When pulling in TortoiseGit, an error occurred: error: some local refs could not be updated; try running 'git remote prune origin' to remove any old, conflicting branches.
Figure 1
Bash

git.exe pull --progress -v --no-rebase "origin"
POST git-upload-pack (165 bytes)
From https://git.xxx.com/object/frontend
= [up to date]          develop                 -> origin/develop
= [up to date]          0.22.0-hotfix           -> origin/0.22.0-hotfix
= [up to date]          antd5                   -> origin/antd5
= [up to date]          hotfix/outbound-order   -> origin/hotfix/outbound-order
= [up to date]          master                  -> origin/master
= [up to date]          od/feat/batch-merge-order -> origin/od/feat/batch-merge-order
= [up to date]          od/feat/count           -> origin/od/feat/count
= [up to date]          od/feat/dispute         -> origin/od/feat/dispute
= [up to date]          od/feat/download-order  -> origin/od/feat/download-order
= [up to date]          od/feat/merge-order-optimize -> origin/od/feat/merge-order-optimize
= [up to date]          od/feat/return          -> origin/od/feat/return
= [up to date]          od/feat/status          -> origin/od/feat/status
= [up to date]          od/feat/warehouse-matching -> origin/od/feat/warehouse-matching
= [up to date]          opt/virtual-table       -> origin/opt/virtual-table
= [up to date]          pdc/feat/add-sort-field -> origin/pdc/feat/add-sort-field
= [up to date]          pdc/feat/image-center   -> origin/pdc/feat/image-center
= [up to date]          pdc/feat/sku-form       -> origin/pdc/feat/sku-form
= [up to date]          pdc/feat/spu-export     -> origin/pdc/feat/spu-export
= [up to date]          pdc/feat/track          -> origin/pdc/feat/track
= [up to date]          sc/1688-opt-test        -> origin/sc/1688-opt-test
= [up to date]          sc/appendix-upload      -> origin/sc/appendix-upload
= [up to date]          sc/feat/purchase-order-ui -> origin/sc/feat/purchase-order-ui
error: cannot lock ref 'refs/remotes/origin/sc/fix/to-be-merged-table-scroller': 'refs/remotes/origin/sc/fix' exists; cannot create 'refs/remotes/origin/sc/fix/to-be-merged-table-scroller'
! [new branch]          sc/fix/to-be-merged-table-scroller -> origin/sc/fix/to-be-merged-table-scroller  (unable to update local ref)
= [up to date]          sc/fixs                 -> origin/sc/fixs
= [up to date]          sc/manual-marking       -> origin/sc/manual-marking
= [up to date]          sc/old-out-of-stock     -> origin/sc/old-out-of-stock
= [up to date]          sc/purchase-list-opt    -> origin/sc/purchase-list-opt
= [up to date]          stage                   -> origin/stage
= [up to date]          test                    -> origin/test
= [up to date]          wh/feat/all-order-export -> origin/wh/feat/all-order-export
= [up to date]          wh/feat/deactivated-warehouse -> origin/wh/feat/deactivated-warehouse
= [up to date]          wh/feat/delivery        -> origin/wh/feat/delivery
= [up to date]          wh/feat/examine         -> origin/wh/feat/examine
= [up to date]          wh/feat/hot-outbound    -> origin/wh/feat/hot-outbound
= [up to date]          wh/feat/in-order        -> origin/wh/feat/in-order
= [up to date]          wh/feat/in-outbound-order-batch-add-custom-sku -> origin/wh/feat/in-outbound-order-batch-add-custom-sku
= [up to date]          wh/feat/modify-position-sku-custom-code -> origin/wh/feat/modify-position-sku-custom-code
= [up to date]          wh/feat/multi-position  -> origin/wh/feat/multi-position
= [up to date]          wh/feat/opt-log         -> origin/wh/feat/opt-log
= [up to date]          wh/feat/order-batch_no  -> origin/wh/feat/order-batch_no
= [up to date]          wh/feat/outbound-order-api -> origin/wh/feat/outbound-order-api
= [up to date]          wh/feat/quick-multi-class-outbound -> origin/wh/feat/quick-multi-class-outbound
= [up to date]          wh/feat/quick-outbound  -> origin/wh/feat/quick-outbound
= [up to date]          wh/feat/quick-single-deliver -> origin/wh/feat/quick-single-deliver
= [up to date]          wh/feat/storage-in-log-export -> origin/wh/feat/storage-in-log-export
= [up to date]          wh/feat/transfer-export -> origin/wh/feat/transfer-export
= [up to date]          wh/feat/transfer-import -> origin/wh/feat/transfer-import
= [up to date]          wh/feat/warehouse-order -> origin/wh/feat/warehouse-order
= [up to date]          wh/fix/custom-text-table -> origin/wh/fix/custom-text-table
= [up to date]          wh/fix/order-selected-keys -> origin/wh/fix/order-selected-keys
error: some local refs could not be updated; try running
'git remote prune origin' to remove any old, conflicting branches


git 未能顺利结束 (退出码 1) (5328 ms @ 2024/04/30 10:09:10)


2. Upon closer inspection of the message, I found: error: cannot lock ref ‘refs/remotes/origin/sc/fix/to-be-merged-table-scroller’: ‘refs/remotes/origin/sc/fix’ exists; cannot create ‘refs/remotes/origin/sc/fix/to-be-merged-table-scroller’. As shown in Figure 2

Upon closer inspection of the message, I found: error: cannot lock ref 'refs/remotes/origin/sc/fix/to-be-merged-table-scroller': 'refs/remotes/origin/sc/fix' exists; cannot create 'refs/remotes/origin/sc/fix/to-be-merged-table-scroller'
Figure 2

3. Reference: When pulling in TortoiseGit, an error occurred: error: cannot lock ref ‘refs/remotes/origin/sc/fix’: ‘refs/remotes/origin/sc/fix/to-be-merge-order’ exists; cannot create ‘refs/remotes/origin/sc/fix’ https://www.shuijingwanwq.com/2024/03/30/8496/ . The issue was resolved.

4. Run the following command in Git Bash: git update-ref -d refs/remotes/origin/sc/fix/to-be-merged-table-scroller.

Plaintext

Lenovo@DESKTOP-QLPK8QM MINGW64 /e/wwwroot/object (develop)
$ git update-ref -d refs/remotes/origin/sc/fix/to-be-merged-table-scroller
error: cannot lock ref 'refs/remotes/origin/sc/fix/to-be-merged-table-scroller': 'refs/remotes/origin/sc/fix' exists; cannot create 'refs/remotes/origin/sc/fix/to-be-merged-table-scroller'
Lenovo@DESKTOP-QLPK8QM MINGW64 /e/wwwroot/object (develop)
$ git update-ref -d refs/remotes/origin/sc/fix


5. Pull in TortoiseGit again; the error no longer appears, and the pull succeeds.

关于作者 · 持续学习与技术实践

我是一名拥有 15 年以上开发经验的技术从业者,自 2013 年起持续运营个人技术博客,记录工作与个人项目中遇到的真实问题,以及解决问题过程中的探索、实践和思考。

除了技术写作,我也在持续开发和维护自己的独立项目,探索新技术和新工具在实际场景中的应用。我始终相信,没有不值得去解决的问题,也没有不值得去学习的技术。

如果这篇文章对你有所帮助,欢迎浏览博客中的其他文章,也欢迎交流技术经验与想法。

关于我  ·  GitHub  ·  邮件联系