Manuals / Git & GitHub / Chapter 3

A · Daily · beginner · Day 2–3 · Chapter 3 of 12

Branches, remotes & push

Branches are cheap pointers. main stays stable. Feature branches isolate work. Remote tracks GitHub.

Path progress
19%

Step 1 of 3

Create and switch branches

git switch -c feature/login. Work. commit. main unchanged until merge.

Create and switch branchesDrag stickies · tap for tips
Study mapDrag stickies · tap for tipsKeep it shortdrag · tap →Name the waitdrag · tap →Scope locatorsdrag · tap →Trace when stuckdrag · tap →One browser firstdrag · tap →Isolate statedrag · tap →Assert the UIdrag · tap →Retry wiselydrag · tap →Seed datadrag · tap →Close the loopdrag · tap →Keep it shortdrag · tap →Name the waitdrag · tap →Scope locatorsdrag · tap →Trace when stuckdrag · tap →One browser firstdrag · tap →Isolate statedrag · tap →Pathwise hackdrag · tap →Create and switch drag · tap →Try thisdrag · tap →Follow the dashed drag · tap →

Example

git switch -c feature/hello
echo "hello" > hello.txt
git add hello.txt
git commit -m "feat: add hello"
git switch main
# hello.txt not here
git switch feature/hello
# hello.txt back

Do this now

Create feature branch, add file, commit, switch back to main — file gone (expected).

Was this step clear?
Chapter learning outcomes
  • branch / checkout / switch
  • push -u origin
  • pull / fetch
  • Tracking branches

Clear these before you leave

Side quest

Branch naming

Adopt pattern: feature/, fix/, docs/ — use consistently.