我试图使用以下命令 pull git 分支 bugfix/validator-integration-bugfix
git fetch && git checkout bugfix/validator-integration-bugfix
但我收到以下错误:
akshaykhale$ git fetch && git checkout bugfix/validator-integration-bugfix
error: cannot lock ref 'refs/remotes/origin/bugfix/connection-failure-bugfix': 'refs/remotes/origin/bugfix' exists; cannot create 'refs/remotes/origin/bugfix/connection-failure-bugfix'
From https://github.com/luxio/luxio-framework
! [new branch] bugfix/connection-failure-bugfix -> origin/bugfix/connection-failure-bugfix (unable to update local ref)
error: cannot lock ref 'refs/remotes/origin/bugfix/migration-datatype-bugfix': 'refs/remotes/origin/bugfix' exists; cannot create 'refs/remotes/origin/bugfix/migration-datatype-bugfix'
! [new branch] bugfix/migration-datatype-bugfix -> origin/bugfix/migration-datatype-bugfix (unable to update local ref)
error: cannot lock ref 'refs/remotes/origin/bugfix/validator-integration-bugfix': 'refs/remotes/origin/bugfix' exists; cannot create 'refs/remotes/origin/bugfix/validator-integration-bugfix'
! [new branch] bugfix/validator-integration-bugfix -> origin/bugfix/validator-integration-bugfix (unable to update local ref)
可能的原因可能是(只是猜测):
我正在获取 bugfix/validator-integration-bugfix
分支,该分支是从其他未在我的开发系统上克隆的分支创建的。
任何解决问题的方法
提前致谢!!!
最佳答案
您团队中的某人创建了一个名为 bugfix
的分支,并将其推送到 origin/bugfix
。因此,Git 不允许您创建名称格式为 origin/bugfix/*
的分支。
我猜测该分支被错误地命名为 bugfix
,因此解决方案是为该分支指定一个更具描述性的名称。
要在本地重命名 bugfix
分支:
git分支-m bugfix bugfix/sensible-name
然后在 Remote 上重命名它:
git Push origin :bugfix bugfix/sensible-name
然后设置重命名的本地分支来跟踪重命名的远程分支:
git Push origin -u bugfix/sensible-name
关于git - 由于引用分支已删除,因此无法获取分支,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57724589/