git branch List, create and delete branches
Manages branches, which are movable labels for lines of work. Without arguments it lists local branches and marks the one you are on with a star.
Synopsis
git branch [OPTION]... [NAME]
Common options
| Option or form | What it does |
|---|---|
-a | List local and remote-tracking branches |
-d NAME | Delete a branch that has been fully merged |
-D NAME | Force-delete a branch even if it is not merged |
-m NEW | -m OLD NEW | Rename a branch |
-vv | Show each branch with its latest commit and upstream |
--merged | List branches already merged into the current one |
Examples
git branch
main
* feature/login
git branch feature/search
git branch -m main
git branch -d feature/login
Deleted branch feature/login (was 3f2a9c1).
git branch --merged main
Notes
- git branch NAME makes the branch but stays where you are. Use git switch -c NAME to create and move in one step.
- -d refuses to delete unmerged work. -D does not, so check first.
- Deleting a local branch does not delete it on the remote. Use git push origin --delete NAME for that.
See also
Last reviewed 2026-10-09.