Difference between revisions of "Git pull"
Jump to navigation
Jump to search
(51 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
− | {{ | + | {{lowercase}} |
+ | <code>git pull</code> ([https://git-scm.com/docs/git-pull doc]) fetch from and integrate with another repository or a local branch. | ||
+ | |||
+ | == Commands == | ||
+ | |||
+ | [[git pull]] | ||
+ | [[git pull -v]] | ||
+ | [[git pull --rebase]] | ||
+ | [[git pull origin main]] | ||
+ | [[git pull origin master]] | ||
+ | [[git pull --all]] | ||
+ | ls | [[parallel]] git -C {} pull | ||
+ | |||
+ | == Examples == | ||
+ | [[git]] pull | ||
+ | Already up to date. | ||
+ | |||
+ | [[git pull -v]] | ||
+ | From github.com:your_account/your_project | ||
+ | = [up to date] [[main]] -> origin/main | ||
+ | Already up to date. | ||
− | git pull | + | git pull -v |
+ | From github.com:your_account/your_project | ||
+ | = [up to date] master -> origin/master | ||
+ | = [up to date] [[dependabot]]/pip/ansible-4.2.0 -> origin/dependabot/pip/ansible-4.2.0 | ||
+ | = [up to date] dependabot/pip/lxml-4.6.5 -> origin/dependabot/pip/lxml-4.6.5 | ||
Already up to date. | Already up to date. | ||
git pull | git pull | ||
− | ssh: | + | remote: Enumerating objects: 5, done. |
− | + | remote: Counting objects: 100% (5/5), done. | |
+ | remote: Compressing objects: 100% (2/2), done. | ||
+ | remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0 | ||
+ | Unpacking objects: 100% (3/3), 288 bytes | 288.00 KiB/s, done. | ||
+ | From ssh://gitlab.your_domain.com:2224/project/project-test | ||
+ | b53cf50..611c5a3 master -> origin/master | ||
+ | Updating b53cf50..611c5a3 | ||
+ | [[Fast-forward]] | ||
+ | file_1.txt | 1 + | ||
+ | 1 file changed, 1 insertion(+) | ||
+ | ls | [[parallel]] [[git -C]] {} pull</code> | ||
git pull | git pull | ||
Line 14: | Line 48: | ||
commands sometime before your next pull: | commands sometime before your next pull: | ||
− | git config pull.rebase false # merge (the default strategy) | + | [[git config]] pull.[[rebase]] false # merge (the default strategy) |
git config pull.rebase true # rebase | git config pull.rebase true # rebase | ||
− | git config pull.ff only # fast-forward only | + | git config pull.ff only # [[fast-forward]] only |
− | + | ||
You can replace "git config" with "git config --global" to set a default | You can replace "git config" with "git config --global" to set a default | ||
preference for all repositories. You can also pass --rebase, --no-rebase, | preference for all repositories. You can also pass --rebase, --no-rebase, | ||
Line 27: | Line 61: | ||
− | == Related | + | |
− | * <code>[[git | + | |
− | * <code>[[git | + | |
+ | [[your branch is behind origin/main]] | ||
+ | |||
+ | == git pull with errors == | ||
+ | git pull | ||
+ | ssh: connect to host XXXXXXX port [[2224]]: [[Operation not permitted]] | ||
+ | fatal: Could not read from remote repository. | ||
+ | |||
+ | git pull | ||
+ | There is no tracking information for the current branch. | ||
+ | Please specify which branch you want to merge with. | ||
+ | See git-pull(1) for details. | ||
+ | |||
+ | git pull <remote> <branch> | ||
+ | |||
+ | If you wish to set tracking information for this branch you can do so | ||
+ | with: | ||
+ | |||
+ | [[git branch]] --set-upstream-to=origin/<branch> main | ||
+ | |||
+ | [[git]] pull | ||
+ | fatal: refusing to merge unrelated histories | ||
+ | |||
+ | git pull | ||
+ | Your configuration specifies to merge with the ref 'refs/heads/master' | ||
+ | from the remote, but no such [[ref]] was fetched. | ||
+ | |||
+ | git pull | ||
+ | fatal: repository 'https://github.com/XXXXXX/' [[not found]] | ||
+ | |||
+ | == Activities == | ||
+ | * Read about the differences between <code>[[git pull]]</code> and <code>[[git fetch]]</code>: https://stackoverflow.com/questions/292357/what-is-the-difference-between-git-pull-and-git-fetch | ||
+ | |||
+ | == Related == | ||
+ | * {{git get}} | ||
+ | * <code>[[git push]]</code> | ||
+ | * <code>[[git merge]]</code> | ||
+ | * <code>[[git config]] [[pull]].[[rebase]] false </code> # merge (the default strategy) | ||
+ | * <code>git config pull.rebase true </code> # rebase | ||
+ | * <code>[[git config]] --global pull.[[ff]] only</code> | ||
+ | * <code>[[git request-pull]]</code> | ||
+ | * <code>[[git status]]</code> | ||
+ | |||
+ | == Related pull commands == | ||
+ | * <code>[[helm pull]]</code> | ||
+ | * <code>[[docker pull]]</code> | ||
== See also == | == See also == | ||
− | * {{git}} | + | * {{git pull}} |
+ | * {{git -C}} | ||
[[Category:git]] | [[Category:git]] |
Latest revision as of 12:46, 22 October 2024
git pull
(doc) fetch from and integrate with another repository or a local branch.
Contents
Commands[edit]
git pull git pull -v git pull --rebase git pull origin main git pull origin master git pull --all ls | parallel git -C {} pull
Examples[edit]
git pull Already up to date.
git pull -v From github.com:your_account/your_project = [up to date] main -> origin/main Already up to date.
git pull -v From github.com:your_account/your_project = [up to date] master -> origin/master = [up to date] dependabot/pip/ansible-4.2.0 -> origin/dependabot/pip/ansible-4.2.0 = [up to date] dependabot/pip/lxml-4.6.5 -> origin/dependabot/pip/lxml-4.6.5 Already up to date.
git pull remote: Enumerating objects: 5, done. remote: Counting objects: 100% (5/5), done. remote: Compressing objects: 100% (2/2), done. remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0 Unpacking objects: 100% (3/3), 288 bytes | 288.00 KiB/s, done. From ssh://gitlab.your_domain.com:2224/project/project-test b53cf50..611c5a3 master -> origin/master Updating b53cf50..611c5a3 Fast-forward file_1.txt | 1 + 1 file changed, 1 insertion(+)
ls | parallel git -C {} pull
git pull warning: Pulling without specifying how to reconcile divergent branches is discouraged. You can squelch this message by running one of the following commands sometime before your next pull: git config pull.rebase false # merge (the default strategy) git config pull.rebase true # rebase git config pull.ff only # fast-forward only You can replace "git config" with "git config --global" to set a default preference for all repositories. You can also pass --rebase, --no-rebase, or --ff-only on the command line to override the configured default per invocation. Your configuration specifies to merge with the ref 'refs/heads/master' from the remote, but no such ref was fetched.
your branch is behind origin/main
git pull with errors[edit]
git pull ssh: connect to host XXXXXXX port 2224: Operation not permitted fatal: Could not read from remote repository.
git pull There is no tracking information for the current branch. Please specify which branch you want to merge with. See git-pull(1) for details. git pull <remote> <branch> If you wish to set tracking information for this branch you can do so with: git branch --set-upstream-to=origin/<branch> main
git pull fatal: refusing to merge unrelated histories
git pull Your configuration specifies to merge with the ref 'refs/heads/master' from the remote, but no such ref was fetched.
git pull fatal: repository 'https://github.com/XXXXXX/' not found
Activities[edit]
- Read about the differences between
git pull
andgit fetch
: https://stackoverflow.com/questions/292357/what-is-the-difference-between-git-pull-and-git-fetch
Related[edit]
git fetch
,git pull
,git clone
git push
git merge
git config pull.rebase false
# merge (the default strategy)git config pull.rebase true
# rebasegit config --global pull.ff only
git request-pull
git status
Related pull commands[edit]
See also[edit]
Advertising: