wiki:git-branches
Table of Contents
Git Branches
Branches are pointers to commits. The default branch is usually main or master. Create a branch to experiment without affecting the main branch, then merge it back when ready. This is how teams work in parallel on different features without conflicts.
$ git branch # list branches $ git branch <name> # create a branch $ git checkout <branch> # switch to a branch $ git switch <branch> # modern way to switch (git 2.23+) $ git branch -d <branch> # delete a branch
Each branch is independent—changes on one branch don't affect others until you merge. Branches are cheap to create; the recommended workflow is to create a branch for each feature or bug fix, work on it in isolation, then merge it back to main once it's tested.
wiki/git-branches.md · Last modified: by 127.0.0.1
