git branch
Lists, creates, renames, or deletes branches.
Syntax
git branch [<options>] [<branch-name>] [<start-point>]
Options
- -a / --all: Lists both local and remote-tracking branches
- -r / --remotes: Lists remote-tracking branches
- -d / --delete: Deletes a fully merged branch
- -D: Force deletes a branch regardless of merge status
- -m / --move: Renames a branch
- -v / --verbose: Shows the last commit on each branch
- --merged: Lists branches that have been merged into the current branch
- --no-merged: Lists branches that have not been merged
Example
git branch git branch feature/login git branch -d old-branch git branch -m old-name new-name