Roadmap › Git & GitHub — Version Control from Basics to Advanced › Module: Git Basics
Lessons in this course (10)
3. Remotes — fetch, pull, push
Basic★ Must knowLesson 3 of 10
bash
git remote -v # list remotes
git fetch origin # download new commits, do NOT change your branch
git pull # fetch + merge (or rebase if pull.rebase=true)
git pull --rebase # fetch + replay your local commits on top
git push -u origin feature/login # first push, set upstream
git push # later pushes
git push --force-with-lease # safe force-push after rebase (fails if someone else pushed)| Command | Changes your working branch? |
|---|---|
git fetch | No — updates origin/* remote-tracking branches only |
git pull | Yes — fetch then merge/rebase into your branch |
Interview tip: "fetch is safe, pull integrates" — and never use plain
--forceon a shared branch; use--force-with-lease.