git pull manpage: don't include -n from fetch-options.txt
[git/mingw/4msysgit.git] / Documentation / git-pull.txt
blobf9f1e0d30b5ba9842d5071d3d3fba3599cd96ebf
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.
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 DEFAULT BEHAVIOUR
48 -----------------
50 Often people use `git pull` without giving any parameter.
51 Traditionally, this has been equivalent to saying `git pull
52 origin`.  However, when configuration `branch.<name>.remote` is
53 present while on branch `<name>`, that value is used instead of
54 `origin`.
56 In order to determine what URL to use to fetch from, the value
57 of the configuration `remote.<origin>.url` is consulted
58 and if there is not any such variable, the value on `URL: ` line
59 in `$GIT_DIR/remotes/<origin>` file is used.
61 In order to determine what remote branches to fetch (and
62 optionally store in the tracking branches) when the command is
63 run without any refspec parameters on the command line, values
64 of the configuration variable `remote.<origin>.fetch` are
65 consulted, and if there aren't any, `$GIT_DIR/remotes/<origin>`
66 file is consulted and its `Pull: ` lines are used.
67 In addition to the refspec formats described in the OPTIONS
68 section, you can have a globbing refspec that looks like this:
70 ------------
71 refs/heads/*:refs/remotes/origin/*
72 ------------
74 A globbing refspec must have a non-empty RHS (i.e. must store
75 what were fetched in tracking branches), and its LHS and RHS
76 must end with `/*`.  The above specifies that all remote
77 branches are tracked using tracking branches in
78 `refs/remotes/origin/` hierarchy under the same name.
80 The rule to determine which remote branch to merge after
81 fetching is a bit involved, in order not to break backward
82 compatibility.
84 If explicit refspecs were given on the command
85 line of `git pull`, they are all merged.
87 When no refspec was given on the command line, then `git pull`
88 uses the refspec from the configuration or
89 `$GIT_DIR/remotes/<origin>`.  In such cases, the following
90 rules apply:
92 . If `branch.<name>.merge` configuration for the current
93   branch `<name>` exists, that is the name of the branch at the
94   remote site that is merged.
96 . If the refspec is a globbing one, nothing is merged.
98 . Otherwise the remote branch of the first refspec is merged.
101 EXAMPLES
102 --------
104 git pull, git pull origin::
105         Update the remote-tracking branches for the repository
106         you cloned from, then merge one of them into your
107         current branch.  Normally the branch merged in is
108         the HEAD of the remote repository, but the choice is
109         determined by the branch.<name>.remote and
110         branch.<name>.merge options; see linkgit:git-config[1]
111         for details.
113 git pull origin next::
114         Merge into the current branch the remote branch `next`;
115         leaves a copy of `next` temporarily in FETCH_HEAD, but
116         does not update any remote-tracking branches.
118 git pull . fixes enhancements::
119         Bundle local branch `fixes` and `enhancements` on top of
120         the current branch, making an Octopus merge.  This `git pull .`
121         syntax is equivalent to `git merge`.
123 git pull -s ours . obsolete::
124         Merge local branch `obsolete` into the current branch,
125         using `ours` merge strategy.
127 git pull --no-commit . maint::
128         Merge local branch `maint` into the current branch, but
129         do not make a commit automatically.  This can be used
130         when you want to include further changes to the merge,
131         or want to write your own merge commit message.
133 You should refrain from abusing this option to sneak substantial
134 changes into a merge commit.  Small fixups like bumping
135 release/version name would be acceptable.
137 Command line pull of multiple branches from one repository::
139 ------------------------------------------------
140 $ git checkout master
141 $ git fetch origin +pu:pu maint:tmp
142 $ git pull . tmp
143 ------------------------------------------------
145 This updates (or creates, as necessary) branches `pu` and `tmp`
146 in the local repository by fetching from the branches
147 (respectively) `pu` and `maint` from the remote repository.
149 The `pu` branch will be updated even if it is does not
150 fast-forward; the others will not be.
152 The final command then merges the newly fetched `tmp` into master.
155 If you tried a pull which resulted in a complex conflicts and
156 would want to start over, you can recover with
157 linkgit:git-reset[1].
160 SEE ALSO
161 --------
162 linkgit:git-fetch[1], linkgit:git-merge[1], linkgit:git-config[1]
165 Author
166 ------
167 Written by Linus Torvalds <torvalds@osdl.org>
168 and Junio C Hamano <junkio@cox.net>
170 Documentation
171 --------------
172 Documentation by Jon Loeliger,
173 David Greaves,
174 Junio C Hamano and the git-list <git@vger.kernel.org>.
178 Part of the linkgit:git[7] suite