gitless
gitless copied to clipboard
Remove remote-tracking branch on branch deletion or unset upstream if it is not used anymore
I deleted a branch that I just merged in master. That branch had an upstream branch, but the upstream pointer is not removed from the git repository.
The branch was named feature-xxx and the upstream branch origin/feature-xxx.
When I delete the branch feature-xxx, the pointer for origin/feature-xxx is still there.
I can see it with git branch -r. In fact I also use gitk who displays it too.
How can I remove this origin/feature-xxx pointer ? I don't feel like trying to gl branch -d origin/feature-xxx because I fear it affects the origin repository.
Shouldn't deleting a branch also delete the upstream branch pointer ?
Yes, we should. I assume you just want this so as to save space, right?
Don't do gl branch -d origin/feature-xxx, that will delete the branch in the remote repository (in Gitless, origin/feature-xxx refers to the feature-xxx branch that lives in the remote repository origin)
Yes. I tried it. Thankfully I was asked if I wanted to remove the remote branch.
I could remove the remote pointer with the git command git branch -d -r origin/feature-xxx.
If I understood correctly, this branch/pointer is useless once the local branch is removed. It shows up in gui tools like gitk for instance. The unset-upstream doesn't remove it.
Could it also be removed if the branch tracking it is removed and there are not other branch tracking it ? Thanks
Yes, we can remove Git's remote-tracking branch pointer if no other branch is using it in that case too