# Git Pushing and pulling **Pushing** sends your commits to a remote; **pulling** fetches and merges from a remote. Push when you've committed changes locally and want to share them. Pull before pushing to avoid conflicts, and pull regularly to stay in sync with teammates. ```bash $ git push # push commits to remote $ git push origin main # common: push main to origin $ git pull # fetch and merge from remote $ git pull origin main # common: pull main from origin $ git fetch # fetch without merging ``` `git pull` is shorthand for `git fetch` followed by `git merge`. If the remote has new commits you haven't pulled yet, pushing will fail—you must pull first to avoid overwriting teammates' work. Use `git pull --rebase` if you prefer rebasing over merging.