We’ve all been there: pushing straight to main, writing commit messages like "fix stuff", and dreading the moment someone mentions merge conflicts or branch topology.

When you're building solo, you can get away with git add . and git push origin main. But the moment you collaborate with a team, work in an open-source project, or maintain production software, messy Git habits quickly turn into broken builds and lost code.

In this post, I’ll walk you through a practical, lightweight Git branching workflow modeled on real-world team practices (often called Git Flow Light). We'll set up a project, create feature branches, use the GitHub CLI (gh) for Pull Requests, intentionally create and resolve a merge conflict, and cover the most common Git errors you will face along the way.

Before typing commands into the terminal, let’s demystify two core Git mechanics that make everything click:

The Three-Tree Architecture