Learn the concept of branches & how to use them for Git beginners

For beginners new to Git, you might wonder, "Why divide things up so
complicatedly?" or "Can't I just save and push?" That's why this time, I'll break down why branch strategies are needed, when to use them, and when they're useful for situations beginners face—all explained simply.

🍊 Git Branch Strategy, Made Easy for Beginners!

💡 Why do you need a Git branching strategy?

If you're working on code alone, using just the main branch is perfectly fine.
But if any of the following situations apply? A branch strategy is absolutely essential.

✅ 3 Essential Scenarios

ScenarioDescriptionWhat Git Branch Strategy Solves
Development by more than one personMultiple people editing simultaneously → Risk of conflictsWorking individually feat/*Work individually → devthen merge, minimizing conflicts
Accidentally breaking the codeApp errors caused by incorrect modifications during codingmainAlways maintain a stable state! Keep experiments devin
Experimenting with new featuresDeveloping unvalidated featuresfeat/*Experiment freely in [branch name], then get reviewed and merge

🤔 Common beginner issues vs. branch strategy

Common ProblemsChanges After Implementing Branch Strategy
"I don't know what I changed"Track history with commits & branches
"I broke the whole app while fixing one feature"feat/*Experimentation, mainAlways functions normally
"We're working together, but our code keeps getting tangled"Minimize conflicts by following: Branch → Review → Merge

🔍 When should I use which branch?

SituationBranch to useDescription
When creating a new featurefeat/기능명This is my workspace. Feel free to experiment!
When you've finished building the feature and are ready to sharePR → devAutomated testing + reviewer review
When deploying the service to usersmainOnly deploy error-free code (release tags are also created at this stage)
When urgently fixing errorshotfix/이름Fix immediately and mainand merge immediately (version tags are also created)

🧠 Core Summary Reorganized with an analogy

ConceptAnalogyRole
main🏛 Deployable Exhibition HallOnly displays completed works
dev🧪 LaboratoryWhere artists' works gather for review
feat/*🎨 Private StudioA space where each artist is engaged in creative activities

🧪 Practice Routines Beginners Can Try

🌱 1. Try applying branch strategy for the first time

# 1. dev 브랜치에서 최신 코드 받아오기
git checkout dev
git pull

# 2. 새로운 작업 브랜치 생성
git checkout -b feat/hello-api

# 3. 작업 + 저장
echo "Hello API!" >> api.py
git add api.py
git commit -m "feat(api): 인사 API 스텁 추가"

# 4. GitHub로 푸시 + PR 만들기
git push --set-upstream origin feat/hello-api

🔐 Security & Mistake Prevention Tips

ItemPoints to noteAction
Committing Sensitive Information.env, 비밀번호, API 키 etc..gitignoreExclude and verify before committing
Force Push (--force)Misuse may overwrite collaborators' workNever decide alone; notify via Slack when sharing is needed
Branch name errorsTypos or duplicatesEstablish naming conventions beforehand and verify before starting work
GitHub public reposAccidentally pushing sensitive filesUpload only code to public repos; separate configuration files

🎯 Summary: Practical Branch Strategy for Beginners

Action ItemsDescription
✅ Before working git pullAlwaysPrevent conflicts, reflect latest code
✅ One branch per featureIncrease focus and simplify history management
✅ Commit frequently in small incrementsmakes it easier to revert later
✅ Always request a code review after a PRPrevents mistakes and aids growth

🚀 Final tip: Start like this!

  1. Create a branch today dev Create a branch today.
  2. .gitignore Create a file to block sensitive files!
  3. Create a branch, README.md and practice the entire process: make changes → create a PR → request a review!

Leave a Comment

목차