I apologize if this is a duplicate, but I don't know if this is a git "feature" or zsh, but I have a TON of delete branches that have been deleted stored somewhere if I tab over.
I have tried prune
and that appears to not be doing want I intend.
The only branches I have locally are:
master
development
fix/root-cleanup
This is because "git pull" does not remove remote tracking branches for branches deleted from remote repo.
The easiest way to delete local Git branches is to use the “git branch” command with the “-d” option. The “-d” option stands for “–delete” and it can be used whenever the branch you want to clean up is completely merged with your upstream branch.
fpath : The git-completion. zsh is a function file, not designed to be sourced like the bash script. This command appends the ~/. zsh directory onto the shell's function lookup list.
They're unnecessary. In most cases, branches, especially branches that were related to a pull request that has since been accepted, serve no purpose. They're clutter. They don't add any significant technical overhead, but they make it more difficult for humans to work with lists of branches in the repository.
Apparently, the autocomplete tab was showing all the names of remote branches I had not done housekeeping on.
Found clues reading this blog post.
I was fixated on local and did not even consider if the plugin was pulling from the remote branches.
What's frustrating is that as in the screenshot all the branches without origin/
were not local and not there. As soon as I started to delete the remote branches these ones disappeared as well.
Maybe installing a oh-my-zsh plugin like diazod/git-prune would help apply the various git prune
aliases.
That in turn should reduce the number of branches considerably.
Note that, with Git 2.28 (Q3 2020), "git prune" has been added to the completion (in contrib/
), which could be typed by end-users from the command line.
See commit 81120a9 (22 Jun 2020) by John Lin (johnlinp
).
(Merged by Junio C Hamano -- gitster
-- in commit 65ffaca, 06 Jul 2020)
bash-completion
: add git-prune into bash completionSigned-off-by: John Lin
Sometimes
git
would suggest the user to rungit prune
when there are too many unreachable loose objects.
It's more user-friendly if we addgit prune
into bash completion.
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