• TIL: Efficient Sorting of Git Branches

    In Git, branches are sorted alphabetically by default. This is convenient when you remember the branch name, but it's not always the most practical approach. Fortunately, the sorting order can be customized to display branches with the latest changes first:

    git branch --sort=-committerdate

    Optionally, -r can be added to search for a remote branch. This is particularly useful when looking for a branch previously worked on with a teammate.

    I have set this as the default in my personal .gitconfig:

    [branch]
        sort = -committerdate
  • Cleaning Up Local Git Branches

    Over time, I accumulate several local Git branches in various projects. To maintain clarity, I regularly delete all branches except the main branch.

    To avoid having to constantly search for the command, I'd like to share it with you here:

    git branch | grep -v "main" | xargs git branch -d

    git branch lists all local branches. grep -v "main" filters out the main branch from this list, as I don't want to delete it. xargs git branch -d executes the git branch -d command on the remaining branches.

    If you want to keep multiple branches, you can extend the command:

    git branch | grep -v "main" | grep -v "develop" | xargs git branch -d

    Here, two branches, main and develop, are filtered out from the list and thus not deleted.

    I hope this tip helps you keep your system as tidy as it helps me.

  • TIL: Smaller PDFs

    Now and then I want to create PDFs and optimize the file size. I'm not necessarily in the mood to add another PDF software to my computer, and, depending on the content of the document, I don't want to complete the task online. In this situation, you can do well with Ghostscript.

    The first thing you have to do is install Ghostscript on your computer. On a Mac with Homebrew, you can accomplish this with the following command:

    brew install ghostscript

    To optimize a PDF, I use the following command.

    gs -sDEVICE=pdfwrite -dPDFSETTINGS=/ebook -dNOPAUSE -dQUIET -dBATCH -sOutputFile="output.pdf" input.pdf
  • How to - Randall Munroe

    Nach "What if" folgt also "How to", welches auf den ersten Blick die logische Fortsetzung des vorherigen Buchs von Randall Munroe ist. An vielen Stellen gelingt das gut, jetzt, wo ich das Buch abgeschlossen habe, frage ich mich, ob ich zwischen den Büchern mehr Zeit hätte lassen sollen.

  • Owning my podcast again

    A few weeks ago, I decided to reactivate my podcast, "Herr Zenzes wills wissen". For the last few years, I hosted it with Podigee, but it became too expensive for my use case. I don't produce enough content to take full advantage of the smallest package, so I can save some money by hosting the podcast myself again.