A while back I found myself getting mildly annoyed by the friction around ensuring a repo’s git was in the correct state for starting a new task with Claude Code.
Am I on the default branch so Claude Code doesn’t create a PR based on another branch it shouldn’t?
Is the default branch up-to-date with origin?
Is the branch I was on previously merged and ready to be deleted?
I ended up adding a GitHub CLI alias built on top of gh-poi, a GitHub CLI plugin that deletes branches that are already merged into the default branch. I called the alias “doi” based on it running “poi” on the default branch.
With my alias set, I run gh doi in terminal, which runs the following commands:
# Save default branch name, so it'll work if your
# default branch is main or master or development
# or whatever
DEFAULT=$(gh repo view --json defaultBranchRef --jq ".defaultBranchRef.name")
# Checkout default branch
git checkout "$DEFAULT"
# Pull default branch
git pull
# Delete merged branches
gh poiHere’s how to install gh-poi and add the alias:
gh extension install seachicken/gh-poi
gh alias set doi '!DEFAULT=$(gh repo view --json defaultBranchRef --jq ".defaultBranchRef.name") && git checkout "$DEFAULT" && git pull && gh poi'And that’s it. You’re ready to run gh doi the next time you want to make sure your working tree is prepped to start a new task.
No posts

Comments
Nothing yet. Say the first thing.
Sign in to join the conversation.