gpt4 book ai didi

git delete branch with name 包含特殊字符

转载 作者:太空狗 更新时间:2023-10-29 14:43:45 25 4
gpt4 key购买 nike

你能帮帮我吗?我创建了一个名称错误的 git 分支,但我无法删除它,因为该名称包含一些疯狂的字符。我复制并粘贴了名称,不幸的是在文本末尾有一些看不见的字符。

>git ls-remote
5fe385e6bd6b49f87f470e0a5b22b67042b179ad HEAD
dbdadb9d8c630782144028d50f01b84a6ff61612 refs/heads/feature/ABC-495-test1
6660c993b5a5e35922a1f7b3f2bb75c6b0996f6e refs/heads/feature/ABC-496
dbdadb9d8c630782144028d50f01b84a6ff61612 refs/heads/feature/ABC-501-mapping
dbdadb9d8c630782144028d50f01b84a6ff61612 refs/heads/feature/ABC-501-mapping?
5fe385e6bd6b49f87f470e0a5b22b67042b179ad refs/heads/master

我想删除名称为“refs/heads/feature/ABC-501-mapping?”的分支,但我不知道如何:(

谢谢

最佳答案

试试这个:

$ git checkout master
$ git branch -D "feature\/ABC-501-mapping\?" # delete local branch
$ git push origin :"feature\/ABC-501-mapping\?" # delete remote branch

或者,

$ cd .git/refs/heads
$ rm "feature/ABC-501-mapping?"

关于git delete branch with name 包含特殊字符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41264567/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com