dev notes

software development craftsmanship

/ home [ / blog / letter / springer link / brain / relaunch / time for money, money for time / first steps with rasmus / connect the dots / get in touch with vue / Alternative content management system approach / A database gate keeper / Generate a ERM from a PostgreSQL database schema / Working with immutable data in Postgres / Automatically update MIT licenses / Moving ORM Mapping towards the database / providing test data for databases / using pandoc filters to create graphs with hakyll / get in touch with react / six months in new job / days left / minimum viable product / Repository ownership / getting better / git cleanup ]


git cleanup

After working over months with several developers on one repository, a little bit "tree care" is necessary. Usually old merged branches are deleted on server, when they are not needed any more.

for branch in `git branch -r --merged master`;
    comitter=`git show --format="%an" $branch | head -n 1;`
    if [ "$comitter" = "$1" ]; then
        echo -e "$branch"

Feature branches can be found like:

./ "Jan Frederik Hake" | grep feature

If you cut of the remote prefix a call to

./ "Jan Frederik Hake" | grep feature | cut -d '/' -f 2,3 | xargs git push origin --delete

deletes the merged branches from a remote repository.