Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1 | git-pull(1) |
| 2 | =========== |
| 3 | |
| 4 | NAME |
| 5 | ---- |
Junio C Hamano | 0107892 | 2006-03-10 00:31:47 | [diff] [blame] | 6 | git-pull - Pull and merge from another repository |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 7 | |
| 8 | |
| 9 | SYNOPSIS |
| 10 | -------- |
| 11 | 'git-pull' <options> <repository> <refspec>... |
| 12 | |
| 13 | |
| 14 | DESCRIPTION |
| 15 | ----------- |
| 16 | Runs `git-fetch` with the given parameters, and calls `git-merge` |
| 17 | to merge the retrieved head(s) into the current branch. |
| 18 | |
| 19 | Note that you can use `.` (current directory) as the |
| 20 | <repository> to pull from the local repository -- this is useful |
| 21 | when merging local branches into the current branch. |
| 22 | |
| 23 | |
| 24 | OPTIONS |
| 25 | ------- |
| 26 | include::merge-options.txt[] |
| 27 | |
| 28 | include::fetch-options.txt[] |
| 29 | |
| 30 | include::pull-fetch-param.txt[] |
| 31 | |
Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 32 | include::urls.txt[] |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 33 | |
Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 34 | include::merge-strategies.txt[] |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 35 | |
| 36 | EXAMPLES |
| 37 | -------- |
| 38 | |
| 39 | git pull, git pull origin:: |
| 40 | Fetch the default head from the repository you cloned |
| 41 | from and merge it into your current branch. |
| 42 | |
| 43 | git pull -s ours . obsolete:: |
| 44 | Merge local branch `obsolete` into the current branch, |
| 45 | using `ours` merge strategy. |
| 46 | |
| 47 | git pull . fixes enhancements:: |
| 48 | Bundle local branch `fixes` and `enhancements` on top of |
| 49 | the current branch, making an Octopus merge. |
| 50 | |
| 51 | git pull --no-commit . maint:: |
| 52 | Merge local branch `maint` into the current branch, but |
| 53 | do not make a commit automatically. This can be used |
| 54 | when you want to include further changes to the merge, |
| 55 | or want to write your own merge commit message. |
| 56 | + |
| 57 | You should refrain from abusing this option to sneak substantial |
| 58 | changes into a merge commit. Small fixups like bumping |
| 59 | release/version name would be acceptable. |
| 60 | |
| 61 | Command line pull of multiple branches from one repository:: |
| 62 | + |
| 63 | ------------------------------------------------ |
| 64 | $ cat .git/remotes/origin |
| 65 | URL: git://git.kernel.org/pub/scm/git/git.git |
| 66 | Pull: master:origin |
| 67 | |
| 68 | $ git checkout master |
| 69 | $ git fetch origin master:origin +pu:pu maint:maint |
| 70 | $ git pull . origin |
| 71 | ------------------------------------------------ |
| 72 | + |
| 73 | Here, a typical `.git/remotes/origin` file from a |
| 74 | `git-clone` operation is used in combination with |
| 75 | command line options to `git-fetch` to first update |
| 76 | multiple branches of the local repository and then |
| 77 | to merge the remote `origin` branch into the local |
| 78 | `master` branch. The local `pu` branch is updated |
| 79 | even if it does not result in a fast forward update. |
| 80 | Here, the pull can obtain its objects from the local |
| 81 | repository using `.`, as the previous `git-fetch` is |
| 82 | known to have already obtained and made available |
| 83 | all the necessary objects. |
| 84 | |
| 85 | |
| 86 | Pull of multiple branches from one repository using `.git/remotes` file:: |
| 87 | + |
| 88 | ------------------------------------------------ |
| 89 | $ cat .git/remotes/origin |
| 90 | URL: git://git.kernel.org/pub/scm/git/git.git |
| 91 | Pull: master:origin |
| 92 | Pull: +pu:pu |
| 93 | Pull: maint:maint |
| 94 | |
| 95 | $ git checkout master |
| 96 | $ git pull origin |
| 97 | ------------------------------------------------ |
| 98 | + |
| 99 | Here, a typical `.git/remotes/origin` file from a |
| 100 | `git-clone` operation has been hand-modified to include |
| 101 | the branch-mapping of additional remote and local |
| 102 | heads directly. A single `git-pull` operation while |
| 103 | in the `master` branch will fetch multiple heads and |
| 104 | merge the remote `origin` head into the current, |
| 105 | local `master` branch. |
| 106 | |
| 107 | |
| 108 | If you tried a pull which resulted in a complex conflicts and |
| 109 | would want to start over, you can recover with |
| 110 | gitlink:git-reset[1]. |
| 111 | |
| 112 | |
| 113 | SEE ALSO |
| 114 | -------- |
| 115 | gitlink:git-fetch[1], gitlink:git-merge[1] |
| 116 | |
| 117 | |
| 118 | Author |
| 119 | ------ |
| 120 | Written by Linus Torvalds <torvalds@osdl.org> |
| 121 | and Junio C Hamano <junkio@cox.net> |
| 122 | |
| 123 | Documentation |
| 124 | -------------- |
| 125 | Documentation by Jon Loeliger, |
| 126 | David Greaves, |
| 127 | Junio C Hamano and the git-list <git@vger.kernel.org>. |
| 128 | |
| 129 | GIT |
| 130 | --- |
| 131 | Part of the gitlink:git[7] suite |
| 132 | |