[HN Gopher] Git: Deletion of merged branches taken beyond shell ... ___________________________________________________________________ Git: Deletion of merged branches taken beyond shell hacks Author : spyc Score : 35 points Date : 2020-08-12 19:34 UTC (3 hours ago) (HTM) web link (github.com) (TXT) w3m dump (github.com) | chmaynard wrote: | Instead of re-packaging various git commands, I'd like to | encourage people to contribute their ideas and skills to the | actual git project. Send an email to git@vger.kernel.org, | volunteer to help, and ask for advice and direction. Git needs | you! | RyJones wrote: | Maybe? We've had mentorships over the last couple of years | trying to introduce some crypto features to Git, and they've | been rebuffed. | justincormack wrote: | What sort of features? | nhumrich wrote: | why not just set `git config fetch.prune true`? | brown9-2 wrote: | I don't think this detects a branch that can be deleted after a | squash merge to master | chrisweekly wrote: | Amazing timing! I was just auditing a colleague's (admittedly | fairly well-written) shell script for this purpose. Nice to have | this alternative. | maximilianroos wrote: | Does this have any advantage over git trim? | | That's worked really well for me | | https://github.com/foriequal0/git-trim | exabrial wrote: | requires a python installation which brings a lot of stuff and | new vulnerabilities... instead, see the other post about | contributing straight to the git project | CognitiveLens wrote: | yeah it's been awhile since I've set up a python-ready | environment, and trying to install this reminded me of the | challenge of just getting to the expected starting point. | $ pip install git-delete-merged-branches zsh: command not | found: pip $ brew install pip Error: No available | formula with the name "pip" pip is part of the python | formula: brew install python $ brew install | python ... OK $ pip install git-delete- | merged-branches zsh: command not found: pip | (look up how to install pip) $ curl | https://bootstrap.pypa.io/get-pip.py -o get-pip.py $ | python get-pip.py WARNING: The scripts pip, pip2 and | pip2.7 are installed in | '/Users/{me}/Library/Python/2.7/bin' which is not on PATH. | Consider adding this directory to PATH or, if you prefer to | suppress this warning, use --no-warn-script-location. | Successfully installed pip-20.2.2 $ pip install git- | delete-merged-branches zsh: command not found: pip | (walk away) | | I know there are solutions to all this, and it's mainly that I | don't already have my $PATH set up the way that pip expects, | etc, but really?? | fuhrysteve wrote: | To be fair, python isn't the only language whose package | management system is all but incoherent to folks who don't | use python every day (and sometimes even to them!). npm is | pretty rough to get setup too, and you run into a lot of | issues similar to this. | wonderlg wrote: | I don't think Node has trouble from the very first | installation. A brew install will set you up with the | latest version of both node and npm and they will work. | | At most you'll have trouble running the right version (rare | nowadays, unlike in pre-v1 days) | viraptor wrote: | This looks like brew issue more than python. `brew unlink | python ; brew link python` may help you. | [deleted] | vikin9 wrote: | Not so fancy, but a one-liner # Remove all local | branches for which there is no remote git branch -r | awk | '{print $1}' | egrep -v -f /dev/fd/0 <(git branch -vv | grep | origin) | awk '{print $1}' | xargs git branch -D ___________________________________________________________________ (page generated 2020-08-12 23:00 UTC)