Use git push to create a new, better-named branch pointing to that same ID (which in this case will begin with 022873b):git push MWNG 022873b...:refs/heads/feature/joe-used-a-bad-name(注意:如果SHA-1 ID是唯一的,您也许可以使用缩写的SHA-1 ID.如果不是,请粘贴确切的ID,这样肯定可以.)(note: you may be able to just use the abbreviated SHA-1 ID, if it's unique. If not, paste in the exact ID, which will definitely work.)使用 git push 来删除错误名称:git push MWNG :Feature/2005-registrering-sunnhetsbonus(或 git push --delete MWNG Feature/2005-registrering-sunnhetsbonus ,这是执行相同操作的时间更长但更令人难忘的方法).只要避免使用-delete 标志:可以将其与ID和新名称以及空字符串同时使用的 git push 标志,就可以将其与步骤3结合使用-and-old-name.(or git push --delete MWNG Feature/2005-registrering-sunnhetsbonus, which is a longer but more memorable way to do the same thing). You can combine this with step 3 as long as you avoid the --delete flag: one git push with both the ID-and-new-name, and empty-string-and-old-name.最后,运行 git fetch --prune MWNG 用新名称更新您自己的存储库.Last, run git fetch --prune MWNG to update your own repository with the new names.如果您不需要保留名称的一个版本,则要容易得多:只需删除坏"名称,再加上最后的fetch-with-prune-option选项即可取消混淆您自己的GitIf you don't need to preserve one version of the name, it's much easier: just do the deletion push on the "bad" name, plus the final fetch-with-prune-option to un-confuse your own Git. 这篇关于为什么git继续使用强制更新来重新创建分支?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-24 06:23