Korean

Git Branching Workflow

Dev Guides / git-branching.html

guidesEnv: Git 2.40+ (any OS)Verified: 2026-10-19

A step-by-step basic workflow: work on a feature branch, review, then merge.

๐Ÿ’ฌ Keep main always working; do work on a branch.

  • Branch: an isolated line of work.
  • Commit: a recorded change unit.
  • Merge: combine one branch's changes into another.

Step by step

# 1) move to up-to-date main
git switch main
git pull

# 2) create a feature branch
git switch -c feature/login

# 3) work, then record
git add -A
git commit -m "feat: add login form"

# 4) push and open a PR
git push -u origin feature/login

Clean up after merge

git switch main
git pull
git branch -d feature/login

Common problems

  • Conflict: both sides changed the same lines. Resolve the <<<<<<< markers and commit again.
  • main moved ahead: git rebase main replays your branch on top.

Sources

Verified date indicates freshness. Check applicability conditions for older material.