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