| Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1 | git-fetch(1) |
| 2 | ============ |
| 3 | |
| 4 | NAME |
| 5 | ---- |
| Junio C Hamano | 7c73c66 | 2007-01-19 00:37:50 | [diff] [blame] | 6 | git-fetch - Download objects and refs from another repository |
| Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 7 | |
| 8 | |
| 9 | SYNOPSIS |
| 10 | -------- |
| Junio C Hamano | 15567bc | 2011-07-23 00:51:59 | [diff] [blame] | 11 | [verse] |
| Junio C Hamano | 3a869c1 | 2010-04-10 07:53:42 | [diff] [blame] | 12 | 'git fetch' [<options>] [<repository> [<refspec>...]] |
| Junio C Hamano | 3a869c1 | 2010-04-10 07:53:42 | [diff] [blame] | 13 | 'git fetch' [<options>] <group> |
| Junio C Hamano | d2179ef | 2010-10-22 04:12:17 | [diff] [blame] | 14 | 'git fetch' --multiple [<options>] [(<repository> | <group>)...] |
| Junio C Hamano | 3a869c1 | 2010-04-10 07:53:42 | [diff] [blame] | 15 | 'git fetch' --all [<options>] |
| Junio C Hamano | 9df0c66 | 2009-11-23 11:09:27 | [diff] [blame] | 16 | |
| Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 17 | |
| 18 | DESCRIPTION |
| 19 | ----------- |
| Junio C Hamano | 9df0c66 | 2009-11-23 11:09:27 | [diff] [blame] | 20 | Fetches named heads or tags from one or more other repositories, |
| 21 | along with the objects necessary to complete them. |
| Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 22 | |
| 23 | The ref names and their object names of fetched refs are stored |
| 24 | in `.git/FETCH_HEAD`. This information is left for a later merge |
| Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 25 | operation done by 'git merge'. |
| Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 26 | |
| Junio C Hamano | 97bcb48 | 2010-11-25 03:16:07 | [diff] [blame] | 27 | When <refspec> stores the fetched result in remote-tracking branches, |
| Junio C Hamano | 8be7073 | 2007-02-10 01:28:40 | [diff] [blame] | 28 | the tags that point at these branches are automatically |
| 29 | followed. This is done by first fetching from the remote using |
| 30 | the given <refspec>s, and if the repository has objects that are |
| 31 | pointed by remote tags that it does not yet have, then fetch |
| 32 | those missing tags. If the other end has tags that point at |
| 33 | branches you are not interested in, you will not get them. |
| 34 | |
| Junio C Hamano | 3eee587 | 2011-04-13 22:40:23 | [diff] [blame] | 35 | 'git fetch' can fetch from either a single named repository, |
| Junio C Hamano | 9df0c66 | 2009-11-23 11:09:27 | [diff] [blame] | 36 | or from several repositories at once if <group> is given and |
| 37 | there is a remotes.<group> entry in the configuration file. |
| 38 | (See linkgit:git-config[1]). |
| Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 39 | |
| 40 | OPTIONS |
| 41 | ------- |
| 42 | include::fetch-options.txt[] |
| 43 | |
| 44 | include::pull-fetch-param.txt[] |
| 45 | |
| Junio C Hamano | 330aae6 | 2007-07-06 17:01:58 | [diff] [blame] | 46 | include::urls-remotes.txt[] |
| Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 47 | |
| Junio C Hamano | c21ab05 | 2009-10-31 04:03:55 | [diff] [blame] | 48 | |
| 49 | EXAMPLES |
| 50 | -------- |
| 51 | |
| 52 | * Update the remote-tracking branches: |
| 53 | + |
| 54 | ------------------------------------------------ |
| 55 | $ git fetch origin |
| 56 | ------------------------------------------------ |
| 57 | + |
| 58 | The above command copies all branches from the remote refs/heads/ |
| 59 | namespace and stores them to the local refs/remotes/origin/ namespace, |
| 60 | unless the branch.<name>.fetch option is used to specify a non-default |
| 61 | refspec. |
| 62 | |
| 63 | * Using refspecs explicitly: |
| 64 | + |
| 65 | ------------------------------------------------ |
| 66 | $ git fetch origin +pu:pu maint:tmp |
| 67 | ------------------------------------------------ |
| 68 | + |
| 69 | This updates (or creates, as necessary) branches `pu` and `tmp` in |
| 70 | the local repository by fetching from the branches (respectively) |
| 71 | `pu` and `maint` from the remote repository. |
| 72 | + |
| 73 | The `pu` branch will be updated even if it is does not fast-forward, |
| 74 | because it is prefixed with a plus sign; `tmp` will not be. |
| 75 | |
| 76 | |
| Junio C Hamano | 5cd1518 | 2011-04-05 00:21:10 | [diff] [blame] | 77 | BUGS |
| 78 | ---- |
| 79 | Using --recurse-submodules can only fetch new commits in already checked |
| 80 | out submodules right now. When e.g. upstream added a new submodule in the |
| 81 | just fetched commits of the superproject the submodule itself can not be |
| 82 | fetched, making it impossible to check out that submodule later without |
| 83 | having to do a fetch again. This is expected to be fixed in a future git |
| 84 | version. |
| 85 | |
| Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 86 | SEE ALSO |
| 87 | -------- |
| Junio C Hamano | 35738e8 | 2008-01-07 07:55:46 | [diff] [blame] | 88 | linkgit:git-pull[1] |
| Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 89 | |
| Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 90 | GIT |
| 91 | --- |
| Junio C Hamano | f7c042d | 2008-06-06 22:50:53 | [diff] [blame] | 92 | Part of the linkgit:git[1] suite |