Remote Operations
5 min read Quiz at the end
Fetch, pull, push, force-push safely, and manage remote branches and tracking relationships.
Working with Remotes
git remote -v
git remote add upstream https://github.com/org/repo.git
# Fetch (download, don't merge)
git fetch origin
git fetch --all
# Pull (fetch + merge)
git pull
git pull origin main
git pull --rebase # rebase instead of merge
# Push
git push origin main
git push --force-with-lease # safe force push (recommended)
git push --tags # push all tags
# Delete remote branch
git push origin --delete feature/login
# Track remote branch
git branch --track main origin/main