不小心创建了一个名为--track的分支,现在我无法删除它
所以我运行了这个命令:
git checkout -b --track origin/RB_1.4.5
我以为它会创建一个同名的本地分支并将其设置为跟踪远程分支,但它却创建了一个名为 --track 的分支。我可以发誓,省略本地分支名称通常会导致它假设您想要与远程分支相同的名称,但我想情况并非如此。
现在运行:
git branch
给我:
* --track
master
我尝试检查 master 然后运行:
git branch -D --track (as well as "--track")
但这没有做任何事情(没有错误或任何事情)。
我尝试删除 .git/config 中的相应行,但仍然没有骰子。
我怎样才能删除那个分支?另外,将来有没有办法做我想做的事情,并且仍然不必重新输入本地分支名称?
So I ran this command:
git checkout -b --track origin/RB_1.4.5
I thought that it would create a local branch by the same name and set it up to track the remote branch, but instead it created a branch called --track. I could have sworn that omitting the local branch name will normally cause it to assume you want the same name as the remote branch, but I guess this wasn't the case.
Now running:
git branch
gives me:
* --track
master
I've tried checking out master and then running:
git branch -D --track (as well as "--track")
but that doesn't do anything (no errors or anything).
I tried removing the corresponding lines in .git/config, but still no dice.
How can I remove that branch? Also, in the future, is there a way to do what I wanted and still not have to re-type the local branch name?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试
应该告诉 git 忽略
--
之后的破折号Try
Should tell git to ignore dashes after
--