One tiny thing that kept annoying me every single day:
Creating sequential Git branches manually.
I often work with branch names like:
feat/toolname-01
feat/toolname-02
feat/toolname-03
And after a few days of development, I found myself constantly doing this mental loop:
"Wait… was the last branch
-07or-08?"
Not exactly a huge problem 😄
But enough friction to become annoying when repeated dozens of times per week.
So I made a tiny helper script that automatically creates the next branch name based on my latest work.
Now I just run:
git smart-branch
and it instantly creates:
feat/toolname-28
✨ No typing
✨ No counting
✨ No context switching
🧠 The Idea
The script is intentionally simple.
It:
- Scans local branches
- Sorts them by latest commit date
- Finds the newest branch matching:
something/something-01
- Increments the number
- Creates the next branch automatically
Example:
feat/toolname-27
→ feat/toolname-28
That’s it.
Tiny automation. Surprisingly satisfying.
💻 The Script
Full gist here:
⚙️ Installation
1. Save the script
I saved mine as:
~/bin/git-smart-branch
Then make it executable:
chmod +x ~/bin/git-smart-branch
2. Add Git alias
Open your:
~/.gitconfig
and add:
[alias]
smart-branch = "!bash ~/bin/git-smart-branch"
3. Use it 🎉
Inside any Git repository:
git smart-branch
Example output:
Latest branch: feat/toolname-27
Creating: feat/toolname-28
Done.
🐙 GitKraken Integration
Originally I wanted this directly inside GitKraken’s branch UI.
Unfortunately GitKraken currently doesn’t support custom branch naming hooks/plugins.
But this still works perfectly through:
- GitKraken integrated terminal
- VSCode terminal
- Warp
- iTerm
- basically any shell
So now my flow inside GitKraken is simply:
git smart-branch
and I’m done.
Honestly… it’s faster than opening the branch modal 😄
🤔 Why Sorting by Commit Date Matters
My first attempt sorted branches alphabetically.
Bad idea.
Because branches like:
feat/payment-03
could accidentally become the “latest” branch even when unrelated.
The final version sorts using:
--sort=-committerdate
which reflects actual recent development activity.
That tiny detail made the script feel much smarter.
🔮 Possible Future Improvements
A few ideas I might add later:
- interactive rename/edit
- multiple independent sequences
- Jira ticket support
- fuzzy matching
- branch templates
- semantic prefixes (
feat/,fix/,release/) - automatic cleanup of old sequences
But honestly…
the current version already solves 95% of the annoyance.
✨ Final Thoughts
This is one of those micro-automations that takes maybe 10 minutes to build…
…but saves tiny bits of mental energy every single day.
And those tiny frictions add up.
Sometimes developer productivity isn’t about giant frameworks or AI tooling.
Sometimes it’s just:
“I don’t want to manually type
-28anymore.”

Top comments (0)