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