git pull
Pull and merge changes from a remote repository into the current branch
Syntax
git pull [<options>] [<remote>] [<refspec>...]
Parameters
| Parameters | Description | Examples | Level |
|---|---|---|---|
--rebase |
rebase merge | git pull --rebase |
Common |
--no-rebase |
merge | git pull --no-rebase |
Common |
--ff-only |
git pull --ff-only |
Advanced | |
--autostash |
git pull --rebase --autostash |
Advanced |
Examples
git pull origin main
and more git fetch + git merge
rebase
git pull --rebase
, Recommended
git pull --rebase --autostash
stash → pull → stash pop
Common Errors
CONFLICT (content): Merge conflict, git add + git commit(merge) git rebase --continue(rebase)
error: cannot pull with rebase: You have unstaged changesgit stash git commit, --autostash
Tips
- git config --global pull.rebase true
- git pull = git fetch + git merge( rebase)