wiki:git-pushing-and-pulling
Table of Contents
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.
$ git push <remote> <branch> # push commits to remote $ git push origin main # common: push main to origin $ git pull <remote> <branch> # fetch and merge from remote $ git pull origin main # common: pull main from origin $ git fetch <remote> # 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.
wiki/git-pushing-and-pulling.md · Last modified: (external edit)
