브랜치 작업
브랜치를 만들고, 전환하고, 이름을 바꾸고, 삭제하여 변경 사항을 격리된 상태로 작업하세요.
Working with branches in Git
A branch in Git is just a movable pointer to a commit, which is why creating one is instant and free. That cheapness shapes the whole workflow: you branch for every feature or fix, work in isolation, and merge back when it is ready. The commands here cover the full branch lifecycle - create, switch, rename, delete.
You will also find the modern split of git checkout into git switch (change branches) and git restore (restore files) covered on these pages, plus git worktree for the day you need two branches checked out at the same time without stashing anything.
자주 묻는 질문
How do I create a new branch and switch to it?
git switch -c feature-name creates the branch and moves you onto it in one step. The older git checkout -b feature-name does exactly the same thing and still works everywhere.What is the difference between git checkout and git switch?
git switch is the modern, branch-only half of git checkout: it changes branches and nothing else. git checkout also restores files and checks out commits, which made it easy to misuse - the split exists so each command does one thing.How do I delete a branch that is already merged?
git branch -d branch-name deletes it locally, and refuses if the branch has unmerged work (use -D to force). If it also exists on the remote, remove it there with git push origin --delete branch-name.