Posted by spencerldixon 15 hours ago
(not on my computer right now to check)
git fetch --all --prune --quiet
git log origin/main --date=format:%m%d%H%M --pretty=format:'%C(yellow)%ad-%h%C(auto)%d %s (%cn)' -n1
git log --tags --date=format:%m%d%H%M --pretty=format:'%C(yellow)%ad-%h%C(auto)%d %s (%cn)' -n1
echo ''
git for-each-ref --count=10 --sort=-committerdate refs/heads/ --format='%(color:yellow)%(committerdate:format:%m%d%H%M)-%(objectname:short) (%(color:green)%(refname:short)%(color:yellow)) %(color:white)%(contents:subject) (%(authorname))'
I include a [month][day][hour][minute]-[git hash] prefix as enough info to see when branches were last updated and grab them when I make a mistake creating the branch from the wrong parent or want to cherry-pick.git branch | lines | where ($it !~ '^*') | each {|br| git branch -D ($br | str trim)} | str trim
hey, gemini, how do I...
git fetch --prune && git branch -vv | awk '/: gone]/{print $1}' | xargs git branch -DI think I probably copied this from Stack Overflow close to a decade ago. Seems like a lot of people have very similar variations.
I am not sure under what usecases, you will end up with a lot of stale branches. And git fetch -pa should fix it locally
A lot of my developer colleagues don't know how git works, so they have no idea that "I merged the PR" != "I deleted the feature branch". I once had to cleanup a couple repositories that had hundreds of branches spanning back 5+ years.
Nowadays I enforce it as the default project setting.
By default, I don't think so. And even if the branch is deleted, objects can still be there. I think GitLab has a "Clean stale objects" thing you can trigger, I don't seem to recall ever seeing any "Git Maintenance" UI actions on GitHub so not sure how it works there.
I see that even the CIA, a federal government office, has not fully used DEI approved, inclusive language yet :-)