删除以连字符开头的分支 [英] Delete a branch starting with a hyphen

查看:41
本文介绍了删除以连字符开头的分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我设法在git中创建了一个名为'-f'的分支

I managed to create a branch in git called '-f'

例如

$ git branch
* (no branch)
   -f

我如何删除当当物品? git branch -d -f不起作用,git branch -d'-f'甚至git branch -d -f -f

How do I delete the dang thing? git branch -d -f won't work, nor will git branch -d '-f' or even git branch -d -f -f

推荐答案

git branch -d -- -f

--符号通常会停止使用许多Linux工具来解析命令行选项.

The -- symbol in general will stop parsing of command line options with many Linux tools.

另一种方法是

git update-ref -d refs/heads/-f

但是git-update-ref相当危险.

这篇关于删除以连字符开头的分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆