Delete Merged Branches with git
It's common courtesy to keep your git branch list clean, especially when colleagues need to fetch your remote branches. I'm a bit of a ... offender, when it comes to maintaining my git branch list. My colleague John Karahalis is not, however, and he hooked me up with an awesome git alias for deleting branches that have been merged into master. Place the following within your .git/config
file:
[alias]
delete-merged-branches = "!f() { git checkout --quiet master && git branch --merged | grep --invert-match '\\*' | xargs -n 1 git branch --delete; git checkout --quiet @{-1}; }; f"
You can run this command via:
git delete-merged-branches
The script worked masterfully -- all branches merged into master were gone and I was left to evaluate which local branches were left to send pull requests for. Beautiful. Keep this around if you're a lazy git-ter like me!
My trip to Mozilla Summit 2013 was incredible. I've spent so much time focusing on my project that I had lost sight of all of the great work Mozillians were putting out. MozSummit provided the perfect reminder of how brilliant my colleagues are and how much...
I remember the early days of JavaScript where you needed a simple function for just about everything because the browser vendors implemented features differently, and not just edge features, basic features, like addEventListener
and attachEvent
. Times have changed but there are still a few functions each developer should...
HTML5 has introduced many features to the browser; some HTML-based, some in the form of JavaScript APIs, but all of them useful. One of my favorites if the introduction of the placeholder
attribute to INPUT elements. The placeholder
attribute shows text in a field until the...
The Web Audio API allows developers to load and decode audio on demand using JavaScript. The more I evaluate awesome games for Firefox OS TVs, the more I get to learn about these APIs that I normally wouldn't touch. The following is a very basic introduction to the WebAudio API...
Nice tip – thanks
Thanks, very handy. Also found this https://gist.github.com/malclocke/943565 to do the same for all merged remote branches.
Also note that you can prune remote-tracking references (e.g., remotes/foo/patch-1) with either
fetch --prune foo
orremote prune foo
.