git branch

The command that lists, creates, renames and deletes branches.

git branch -D deletes unmerged work; it survives only in the reflog until it expires.

In more detail

git branch feature creates a branch at the current commit without switching to it. -v shows each branch's latest commit and -r lists remote-tracking branches. -m renames, -d deletes a branch only if its work is merged, and -D deletes it regardless.

Examples

git branch -m feature notes-tidy
git branch recovered d4e5f6g

Related terms

Taught in

References