git:如何删除本地ref分支? [英] git: How to delete a local ref branch?

查看:584
本文介绍了git:如何删除本地ref分支?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在删除本地ref分支时有点困难(refs / notes / origin / commits)。
我可以使用以下命令删除远程仓库中的分支(refs / notes / origin / commits):

  git push origin:refs / notes / origin / commitits 

但是当我尝试删除同一分支在我的本地存储库中,我得到了下面的错误:

pre $ [User @ centos Clone]#git branch -rd refs / notes / origin /提交
错误:未找到远程分支'refs / notes / origin / commits'。

有何建议?

解决方案

只要做

pre $ git分支-d提交

删除本地分支。



使用 -D <

$ b

 

使用

code>切换到将其删除而不管其合并状态如何。 code> git update-ref -d refs / notes / origin / commitits

删除ref。



您也可以像其他答案中提到的那样通过

  rm -rf .git / refs / notes 


I have bit of a difficulty in deleting a local ref branch(refs/notes/origin/commits). I was able to delete the branch(refs/notes/origin/commits) in the remote repository using the command

git push origin :refs/notes/origin/commits

but when i try to delete the same branch on my local repository, i get the below error

[User@centos Clone]# git branch -rd refs/notes/origin/commits
error: remote branch 'refs/notes/origin/commits' not found.

Any suggestions?

解决方案

Just do

git branch -d commits

to delete the local branch.

Use the -D switch to delete it irrespective of its merged status.

Use

git update-ref -d refs/notes/origin/commits

to delete the ref.

You can also hard-delete it as mentioned in other answers with

rm -rf .git/refs/notes

这篇关于git:如何删除本地ref分支?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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