Add tests for extra headers in format-patch
[git/dscho.git] / Documentation / git-pull.txt
blob179bdfc69ddfeff9d272ec309721e4098f3b051e
1 git-pull(1)
2 ===========
4 NAME
5 ----
6 git-pull - Fetch from and merge with another repository or a local branch
9 SYNOPSIS
10 --------
11 'git-pull' <options> <repository> <refspec>...
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.
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.
24 OPTIONS
25 -------
26 include::merge-options.txt[]
28 :git-pull: 1
29 include::fetch-options.txt[]
31 include::pull-fetch-param.txt[]
33 include::urls-remotes.txt[]
35 include::merge-strategies.txt[]
37 \--rebase::
38         Instead of a merge, perform a rebase after fetching.  If
39         there is a remote ref for the upstream branch, and this branch
40         was rebased since last fetched, the rebase uses that information
41         to avoid rebasing non-local changes.
43 *NOTE:* This is a potentially _dangerous_ mode of operation.
44 It rewrites history, which does not bode well when you
45 published that history already.  Do *not* use this option
46 unless you have read linkgit:git-rebase[1] carefully.
48 \--no-rebase::
49         Override earlier \--rebase.
51 DEFAULT BEHAVIOUR
52 -----------------
54 Often people use `git pull` without giving any parameter.
55 Traditionally, this has been equivalent to saying `git pull
56 origin`.  However, when configuration `branch.<name>.remote` is
57 present while on branch `<name>`, that value is used instead of
58 `origin`.
60 In order to determine what URL to use to fetch from, the value
61 of the configuration `remote.<origin>.url` is consulted
62 and if there is not any such variable, the value on `URL: ` line
63 in `$GIT_DIR/remotes/<origin>` file is used.
65 In order to determine what remote branches to fetch (and
66 optionally store in the tracking branches) when the command is
67 run without any refspec parameters on the command line, values
68 of the configuration variable `remote.<origin>.fetch` are
69 consulted, and if there aren't any, `$GIT_DIR/remotes/<origin>`
70 file is consulted and its `Pull: ` lines are used.
71 In addition to the refspec formats described in the OPTIONS
72 section, you can have a globbing refspec that looks like this:
74 ------------
75 refs/heads/*:refs/remotes/origin/*
76 ------------
78 A globbing refspec must have a non-empty RHS (i.e. must store
79 what were fetched in tracking branches), and its LHS and RHS
80 must end with `/*`.  The above specifies that all remote
81 branches are tracked using tracking branches in
82 `refs/remotes/origin/` hierarchy under the same name.
84 The rule to determine which remote branch to merge after
85 fetching is a bit involved, in order not to break backward
86 compatibility.
88 If explicit refspecs were given on the command
89 line of `git pull`, they are all merged.
91 When no refspec was given on the command line, then `git pull`
92 uses the refspec from the configuration or
93 `$GIT_DIR/remotes/<origin>`.  In such cases, the following
94 rules apply:
96 . If `branch.<name>.merge` configuration for the current
97   branch `<name>` exists, that is the name of the branch at the
98   remote site that is merged.
100 . If the refspec is a globbing one, nothing is merged.
102 . Otherwise the remote branch of the first refspec is merged.
105 EXAMPLES
106 --------
108 git pull, git pull origin::
109         Update the remote-tracking branches for the repository
110         you cloned from, then merge one of them into your
111         current branch.  Normally the branch merged in is
112         the HEAD of the remote repository, but the choice is
113         determined by the branch.<name>.remote and
114         branch.<name>.merge options; see linkgit:git-config[1]
115         for details.
117 git pull origin next::
118         Merge into the current branch the remote branch `next`;
119         leaves a copy of `next` temporarily in FETCH_HEAD, but
120         does not update any remote-tracking branches.
122 git pull . fixes enhancements::
123         Bundle local branch `fixes` and `enhancements` on top of
124         the current branch, making an Octopus merge.  This `git pull .`
125         syntax is equivalent to `git merge`.
127 git pull -s ours . obsolete::
128         Merge local branch `obsolete` into the current branch,
129         using `ours` merge strategy.
131 git pull --no-commit . maint::
132         Merge local branch `maint` into the current branch, but
133         do not make a commit automatically.  This can be used
134         when you want to include further changes to the merge,
135         or want to write your own merge commit message.
137 You should refrain from abusing this option to sneak substantial
138 changes into a merge commit.  Small fixups like bumping
139 release/version name would be acceptable.
141 Command line pull of multiple branches from one repository::
143 ------------------------------------------------
144 $ git checkout master
145 $ git fetch origin +pu:pu maint:tmp
146 $ git pull . tmp
147 ------------------------------------------------
149 This updates (or creates, as necessary) branches `pu` and `tmp`
150 in the local repository by fetching from the branches
151 (respectively) `pu` and `maint` from the remote repository.
153 The `pu` branch will be updated even if it is does not
154 fast-forward; the others will not be.
156 The final command then merges the newly fetched `tmp` into master.
159 If you tried a pull which resulted in a complex conflicts and
160 would want to start over, you can recover with
161 linkgit:git-reset[1].
164 SEE ALSO
165 --------
166 linkgit:git-fetch[1], linkgit:git-merge[1], linkgit:git-config[1]
169 Author
170 ------
171 Written by Linus Torvalds <torvalds@osdl.org>
172 and Junio C Hamano <junkio@cox.net>
174 Documentation
175 --------------
176 Documentation by Jon Loeliger,
177 David Greaves,
178 Junio C Hamano and the git-list <git@vger.kernel.org>.
182 Part of the linkgit:git[7] suite