Git Workflow for Solo Devs

Many git guides assume you work in a team. But what if you are alone? Here's what works for me.

Branch Strategy

I use a simple model:

  • main - always deployable
  • dev - daily work
  • feature/* - bigger features
# Start ny feature
git checkout -b feature/new-thing dev

# Færdig? Merge tilbage
git checkout dev
git merge --no-ff feature/new-thing
git branch -d feature/new-thing

Commit Messages

Use conventional commits - the changelog does this automatically:

feat: add user authentication
fix: resolve memory leak in cache
docs: update API documentation
refactor: simplify database queries

Aliases that save time

git config --global alias.co checkout
git config --global alias.br branch
git config --global alias.st status
git config --global alias.lg "log --oneline --graph --all"

Stash is your friend

# Gem nuværende arbejde
git stash push -m "WIP: login form"

# Se alle stashes
git stash list

# Hent tilbage
git stash pop

Keep it simple!