Recent Posts (Page 2)

pre-commit: How to run hooks during a rebase

Let’s make your rebases soar!

pre-commit uses Git’s hook system to run tools when you commit. Unfortunately, Git doesn’t run any hooks when making a commit during a rebase. This can lead to you rebasing a branch and not realizing some code needs fixing, at least not until your CI system runs pre-commit (say, with


Git: How to set up a global ignore file

A whole stack of papers to ignore (generated by Stable Diffusion)

Have you ever accidentally committed a bunch of junk created by your OS, like Thumbs.db files from Windows, or .DS_Store files from macOS? Or, have you joined a project, and for one of your first commits, added rules to the .gitignore file for your text editor’s project files? If so, this post is for you! You can avoid such pain or busywork by making a global ignore file.


Git: How to automatically stash while rebasing or merging

A veritable stash of almonds (generated by Stable Diffusion)

Imagine you’re part way through making some changes, and you realize that you need to rebase or merge. You can:


Why does Python log a DeprecationWarning saying “invalid escape sequence”?

Invalid essssscape sssssequence...

Take this code, which prints a shruggy man:


Git: How to undo commits

Just press here to undo!

To errr is human, to undo computer can help.


Git: How to automatically create upstream branches

That’s a serious number of branches.

You started a new feature branch, worked hard on initial commits, and you’re ready to send it for review. You try to push and:


Git: How to clean up squash-merged branches


Git hosts offer a “squash merge” option that merges a reviewed branch by combining all its commits into one. This leads to a linear Git history on your main branch, which is easier to understand and refer back to code reviews.


Git: How to alias “master” as “main”

Don’t tangle up those branches!

The Git community is gradually moving the default branch name from “master” to “main”, because the term “master” is hurtful to some people as it refers to slavery.


Git: How to enable autocorrect

I think you meant Qe5!

By default, if you mistype a Git command, it will list similar commands that you might have meant:


django-upgrade Mega Release 1.11.0

Some busy bees have contributed their fixes.

I just released version 1.11.0 of django-upgrade, a tool for automatically upgrading your Django project code. This release contains a lot of new features and fixes, thanks to new contributors including those at the Djangocon Europe sprints. Let’s look at the top changes.