TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Git: Deletion of merged branches taken beyond shell hacks

81 pointsby spycalmost 5 years ago

7 comments

chmaynardalmost 5 years ago
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!
评论 #24137219 未加载
maximilianroosalmost 5 years ago
Does this have any advantage over git trim?<p>That&#x27;s worked really well for me<p><a href="https:&#x2F;&#x2F;github.com&#x2F;foriequal0&#x2F;git-trim" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;foriequal0&#x2F;git-trim</a>
vikin9almost 5 years ago
Not so fancy, but a one-liner<p><pre><code> # Remove all local branches for which there is no remote git branch -r | awk &#x27;{print $1}&#x27; | egrep -v -f &#x2F;dev&#x2F;fd&#x2F;0 &lt;(git branch -vv | grep origin) | awk &#x27;{print $1}&#x27; | xargs git branch -D</code></pre>
评论 #24139774 未加载
评论 #24143562 未加载
评论 #24140729 未加载
chrisweeklyalmost 5 years ago
Amazing timing! I was just auditing a colleague&#x27;s (admittedly fairly well-written) shell script for this purpose. Nice to have this alternative.
nhumrichalmost 5 years ago
why not just set `git config fetch.prune true`?
评论 #24137493 未加载
评论 #24141623 未加载
exabrialalmost 5 years ago
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
评论 #24137490 未加载
评论 #24137152 未加载
piahooalmost 5 years ago
this script just removed my local, never pushed, never merged branch
评论 #24143498 未加载