git-pull
Update local branch with remote changes
TLDR
Download changes from default remote repository and merge it
Download changes from default remote repository and use fast-forward
Download changes from given remote repository and branch, then merge them into HEAD
SYNOPSIS
git pull [options] [repository [<refspec>…]]
PARAMETERS
-q, --quiet
suppress progress reporting and messages
-v, --verbose
be more verbose
--all
fetch from all remotes
--multiple
fetch from multiple remotes
--rebase[=false|interactive]
use rebase instead of merge; false disables, interactive for interactive rebase
--no-rebase
use merge strategy even if rebase configured
--ff[=false]
allow fast-forward; false disables
--no-ff
refuse fast-forward, create merge commit
--ff-only
fast-forward only, abort if merge needed
--commit, --no-commit
perform commit after merge (no-commit leaves index updated)
--edit, -e
edit merge commit message
--no-edit, -n
use predefined commit message
--autostash, --no-autostash
automatically stash and pop uncommitted changes
--prune
prune deleted remote-tracking branches
--dry-run
dry run, show what would be pulled
-p, --progress
force progress reporting
--depth <n>
shallow clone depth
--recurse-submodules[=yes|on-demand|no]
control submodule recursion
DESCRIPTION
The git pull command is a convenient shortcut that combines git fetch and git merge (or git rebase if specified). It downloads the latest changes from a specified remote repository and integrates them into the current working branch.
By default, git pull fetches from the origin remote and merges into the current branch using the tracking branch. This is equivalent to git pull origin. Users can specify a different repository URL or refspec to pull specific branches or tags.
It supports two integration strategies: merging (default) creates a merge commit, while --rebase replays local commits on top of remote changes for a linear history. Options like --ff-only ensure fast-forward only, refusing merges requiring new commits.
git pull is essential for collaborative workflows, keeping local branches in sync with upstream changes. However, it can introduce merge conflicts, requiring manual resolution. Always commit or stash local changes before pulling to avoid overwriting uncommitted work.
Common usage: git pull origin main updates the main branch from remote origin.
CAVEATS
Can overwrite uncommitted changes; resolve conflicts manually. Avoid on shared repos without coordination. Use --ff-only for safety.
REFSPEC FORMAT
Use <local>:<remote> or +<local>:<remote> for forced updates; e.g., git pull origin main:local-main.
CONFIGURATION
pull.rebase sets default strategy; fetch.prune enables auto-pruning.
HISTORY
Introduced in Git v1.0.0 (2005) by Linus Torvalds. Evolved with rebase support in v1.5.0 (2007) and submodule handling in later versions. Core to Git's distributed workflow.
SEE ALSO
git-fetch(1), git-merge(1), git-rebase(1), git-push(1)


