🔀Branch
Also known as Git Branch, git switch
A line of work to one side. Try changes there while main stays safe.
Think of it like
Think of it like a side path off a main road. You can walk it, then join the road again later.
Example
Emma makes a branch called dark-mode. She tries a new look for a week, while main stays safe for everyone else.
Why it matters
Branches let many people work at once. Half-done work never breaks the main code.
Definition
Example code
console
$ git switch -c dark-mode
Switched to a new branch 'dark-mode'
$ git branch
* dark-mode
mainCommon mistake
Key takeaways
- 1Work apart. Changes stay off the main line.
- 2Cheap to make. One command, one second.
- 3Merge back. Finished work joins main again.