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?
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
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
$ git remote add gitlab <url>
$ git push gitlab --delete <branchname>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With