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 progress19%
Step 1 of 3
Create and switch branches
git switch -c feature/login. Work. commit. main unchanged until merge.
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 backDo 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.