SkillByAIOpen interactive version →

Lesson 17 / 28

push, pull, fetch & Tracking

Sync with a remote using git push, pull and fetch, and set upstream tracking with -u.

push and pull

push sends your commits up; pull fetches and merges the remote's commits into your current branch.

git push origin main
git pull origin main

fetch vs pull

git fetch downloads new commits from the remote without merging them — safe to run anytime to just look. git pull is really fetch + merge in one step.

Tracking branches

-u links your local branch to a remote one, so future plain git push / git pull know where to go.

git push -u origin feature/login
# now just:
git push
git pull