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