Git 2.56: Remove a Commit From Every Branch with git history drop

I often commit things that I don’t want to keep: debug settings, a hard-coded value, a quick test. The plan is always to drop them before the review. To do that, I open git rebase -i, find the line, change pick to drop and save. It works, but only for the branch that I have checked out. When I work with stacked pull requests, the second one built on top of the first, the branch below keeps the commit, unless I remember --update-refs. ...

October 12, 2026 · Dmitrii Kotov

Git 2.56: A Bisect That Cleans Up After Itself with --reset-when-found

🎬 Prefer to watch? This walkthrough is also a video on YouTube. I like git bisect a lot. Something is broken, nobody knows since when, and bisect finds the commit in a few steps: you give it a good commit, a bad one, and a script that tells them apart. But when the search is over, it doesn’t clean up. You stay on a detached HEAD, often not even on the culprit. git status keeps saying that you are bisecting, and your branch is locked until you remember to run git bisect reset. I forget it almost every time. ...

October 9, 2026 · Dmitrii Kotov

Git 2.56: Clean Up Merged Branches with git branch --delete-merged

🎬 Prefer to watch? This walkthrough is also a video on YouTube. Every few months I run git branch in a repository I work with every day and see a long list: fix-..., add-..., try-.... Most of these branches are pull requests that were merged weeks ago. Git doesn’t delete them by itself, so they just stay there. Until now, I cleaned them up with a one-liner like this: git branch --merged origin/main | grep -vE '^\*|^ *main$' | xargs git branch -d It works, but it’s easy to get wrong. If you forget the grep, main is in the list too. Every branch is compared with the one ref you typed. And there is no way to say “please keep this one”. ...

October 5, 2026 · Dmitrii Kotov

Git 2.56: Stage Only What You Resolved with git add --resolved

🎬 Prefer to watch? This walkthrough is also a video on YouTube. Every merge conflict ends the same way. You fix the files, and then you have to stage them. And this is exactly the moment when a small accident happens: most of us type git add -u or git add . out of habit. Both commands stage everything that is modified, not only the files you have just resolved. I’ve been bitten by this more than once. A set -x or a debug print in some unrelated file quietly goes into the merge commit together with the resolution. Nobody notices it, because nobody reads merge commits line by line. A few weeks later someone asks why the start script suddenly prints every command. ...

September 30, 2026 · Dmitrii Kotov