git branch
command is a fundamental part of Git that allows you to create, list and manage branches within your repository.
main
or master
, but you can create multiple branches to handle various tasks in parallel.
git branch
? git init
, Git sets up an empty repository and default branch (usually main
or master
) is created.
git commit
command, it saves your initial work onto that default branch.
git branch -M <branch-name>
git branch feature-1
git branch
git checkout feature-1
command.
git commit
command.
main
or master
)
git branch
? git branch <branch-name>
git branch feature-1
git branch
git branch <branch-name> <commit-id>
git branch debug-fix a1b2c3d
git branch -m <new-name>
git branch -m dev
git branch -d <branch-name>
git branch -d old-feature
git branch -r
origin/main
, origin/dev
).
git branch -a
git branch -v
git branch --merged
git branch --no-merged
Your feedback helps us grow! If there's anything we can fix or improve, please let us know.
Weโre here to make our tutorials better based on your thoughts and suggestions.