GitLab显示已删除的分支

时间:2015-06-12 11:31:25

标签: git git-branch gitlab

我在GitLab中显示分支时遇到问题。在显示的分支之间有两个被删除。我认为这是因为他们的名字为origin/ondrat/xxxxxorigin/vladan/xxxxx。所以完整路径pathspec是origin/origin/ondtrat...。这两个分支不会出现在列表git branch -r中,并且无法删除GitLab UI。当我尝试在GitLab中删除它们时,没有任何反应 有没有办法消除它们或者它是一个错误?

3 个答案:

答案 0 :(得分:3)

$ git remote add gitlab <url>
$ git push gitlab --delete <branchname>

答案 1 :(得分:1)

正如一位同事(内部GitLab维护人员)所解释的,the branches are gone but the tracking information is not.要摆脱跟踪信息:

选项1

$ git fetch --prune

选项2(在干净的分支上)

$ git merge --prune

背景

我遇到了类似的情况,即合并到master后,远程分支被删除了,我删除了本地分支,但是远程分支仍然出现在git branch -a

[samveen@development opsgenie_webhook]$ git branch -a
* master
  remotes/origin/HEAD -> origin/master
  remotes/origin/master
  remotes/origin/submodules
  remotes/origin/update1

进一步,在结帐时,回购的状态为detached HEAD

[samveen@development opsgenie_webhook]$ git checkout  remotes/origin/submodules
M   libs
Note: checking out 'remotes/origin/submodules'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b new_branch_name

HEAD is now at 6d9727e... Add target first_init

答案 2 :(得分:0)

你试过推“空”分支吗? 喜欢 git push origin:origin / ondrat / xxxxx