prune local branches if remote branch got removed
extrawurst opened this issue · 3 comments
extrawurst commented
when in the branch list I want to be able to cleanup local tracking branches of remote branches that were removed on the remote
ffes commented
You are referring to the tracking branches, but what about the "real" local feature branches?
Did you know about the setting fetch.prune=true to automatically prune the tracking branches?
To delete the latter I use this bash script, found somewhere presumably stackoverflow, and run it from time to time manually. It would be great if gitui could clean them as well.
#!/usr/bin/env bash
branches=$(git branch --no-color --merged | grep -v "\*" | grep -v master | grep -v main)
if [ -n "$branches" ]
then
echo "$branches" | xargs -n 1 git branch -d
fiextrawurst commented
@ffes actually this is exactly what I had in mind for this ticket. fetch will already do the prune of tracking branches, just like on the regular git cli.
extrawurst commented
closing in favour of #998