Git Push and Pull

Syncing with remote repositories

Push Changes

git push # push to default remote
git push origin main # push to specific branch
git push -u origin branch-name # push and set upstream
git push --force # force push (dangerous)

Pull Changes

git pull # fetch and merge
git pull origin main # pull from specific branch
git pull --rebase # rebase instead of merge

Fetch

git fetch # download remote changes
git fetch origin # fetch from origin
git fetch --all # fetch from all remotes

Remote Management

git remote -v # list remotes
git remote add origin  # add remote
git remote remove origin # remove remote
git remote rename old new # rename remote

Track Remote Branch

git branch --set-upstream-to=origin/main # set upstream
git branch -vv # show tracking branches