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 formWhat it does
-aList local and remote-tracking branches
-d NAMEDelete a branch that has been fully merged
-D NAMEForce-delete a branch even if it is not merged
-m NEW | -m OLD NEWRename a branch
-vvShow each branch with its latest commit and upstream
--mergedList branches already merged into the current one

Examples

List local branches
git branch
  main
* feature/login
Create a branch without switching to it
git branch feature/search
Rename the current branch
git branch -m main
Delete a merged branch
git branch -d feature/login
Deleted branch feature/login (was 3f2a9c1).
See which branches are safe to delete
git branch --merged main

Notes

See also

Last reviewed 2026-10-09.