ADVERTISEMENT
Google AdSense Slot (headerLeaderboard)

Set your Publisher ID in src/config/ads.ts to display live ads.

Git Version Control Tutorial• 7 min read

Remote Repositories: GitHub, Push & Pull

git remote add origin, git push -u, git fetch vs git pull, and tracking branches

Remote repositories hosted on GitHub, GitLab, or Bitbucket enable asynchronous distributed collaboration across software engineering teams.

git fetch vs git pull

git fetch origin: Downloads remote commits and branches to your local tracking store (origin/main), but does NOT modify your working files. 100% safe to inspect.

git pull origin main: A two-in-one command: runs git fetch followed immediately by git merge origin/main into your active branch.

git push -u origin main: Uploads your commits to the remote repo and sets upstream tracking.

Syncing with Remote GitHub Workflow
# Connect local repository to GitHub remote
git remote add origin https://github.com/organization/codexia.git

# Push main branch and set upstream tracking (-u)
git push -u origin main

# Daily team sync: inspect incoming changes safely before merging
git fetch origin
git log HEAD..origin/main --oneline

# Pull and merge remote changes
git pull origin main
git fetch allows safe inspection of team changes before merging.
ADVERTISEMENT
Google AdSense Slot (inContentBanner)

Set your Publisher ID in src/config/ads.ts to display live ads.

Test Yourself With Exercise

+15 XP

What is the critical difference between `git fetch` and `git pull`?