git pull
Fetches from a remote and integrates changes into the current branch. Equivalent to git fetch followed by git merge.
Syntax
git pull [<options>] [<remote>] [<branch>]
Options
- --rebase: Rebases the current branch on top of the fetched branch instead of merging
- --no-rebase: Merges (default behavior)
- --ff-only: Only updates if fast-forward is possible
- --autostash: Automatically stashes and re-applies local changes
Example
git pull git pull origin main git pull --rebase origin main
Tip
Use --rebase to keep a cleaner linear history.