Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GitLab shows deleted branches

I have a problem with showing branches in GitLab. Between displayed branches there are two which were deleted. I believe it is because of their name origin/ondrat/xxxxx and origin/vladan/xxxxx. So the full path pathspec is origin/origin/ondtrat.... These two branches will not appear in the listing git branch -r and in GitLab UI can not be deleted. When i try delete them in GitLab, nothing happens.
Is there a way to eliminate them or is it a bug?

like image 904
Hekimen Avatar asked Jun 12 '15 11:06

Hekimen


2 Answers

As a colleague (the in-house GitLab maintainer) explained, the branches are gone but the tracking information is not. To get rid of the tracking information:

Option 1

$ git fetch --prune

Option 2 (on a clean branch)

$ git merge --prune

Background

I faced a somewhat similar situation where the remote branch was deleted after merging into master, and I deleted the local branch, but the remote branch still showed up in 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

Further, on checkout, the state of the repo is 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
like image 133
Samveen Avatar answered Sep 28 '22 19:09

Samveen


$ git remote add gitlab <url>
$ git push gitlab --delete <branchname>
like image 22
xd1le Avatar answered Sep 28 '22 19:09

xd1le