Branch
A branch is a separate line of development in a Git repository. It lets you work on a new feature or fix in isolation without affecting the main code, then merge it back when ready.
Git & DevOps
Branches are lightweight pointers to a commit, so creating one is instant. The default branch is usually called main (older repos use master).
A common workflow is to create a feature branch off main, make commits there, and merge it back once the work is reviewed and tested.
Syntax
git branch <name>
git switch -c <name>Examples
Bash
git switch -c feature-login
git branchOutput:
main
* feature-login