Algocraft / Git Commands / git fetch, pull & push

🌐

git fetch, pull & push

How your local repo talks to origin — download without merging, download-and-merge, or upload your own commits

Remote Tracking pull = fetch + merge Non-Fast-Forward
Commit Graph Step 0 / 0
Working Directory → Staging → Repository
Terminal Transcript

Key Concepts

🎯 When to Use
  • fetch: check what's new without touching your work
  • pull: start your day, or sync before you push
  • push: share your finished commits
⚖️ Why Push Gets Rejected
  • Git only fast-forwards a remote branch, never overwrites by default
  • If origin has commits you don't, you must integrate them first
🎓 Pro Tips
  • git fetch then inspect before merging is safer than blind pull
  • push --force-with-lease is the safer alternative to --force