# git fetch documentation

2 messages from 2013-06-01 to 2013-06-01. Participants: Nicolas Richard, Ramkumar Ramachandra.
Thread: https://gitlist.dev/t/34007

## Nicolas Richard, 2013-06-01 11:04

Subject: git fetch documentation
Message-ID: <87sj12rt13.fsf@yahoo.fr>
URL: https://gitlist.dev/e/87sj12rt13.fsf%40yahoo.fr

```
Hello,

Regarding the git-fetch man page (IIUC, in pull-fetch-param.txt), in
particular the <refspec> explanation, I feel that two facts are missing:

- A '*' can be used both in src and dest, and it matches any name,
  including subdirectories, but not partial names (i.e. refs/heads/foo*
  is invalid).
- multiple fetch lines can be given in .git/config, each of them will be
  obeyed

These are probably obvious for most users, but I think documenting them
would be good for newcomers. (I tried to come up with a patch but I
can't find a precise yet concise way to explain the role of '*' in
english.)

-- 
Nico.

```

## Ramkumar Ramachandra, 2013-06-01 11:25

Subject: Re: git fetch documentation
Message-ID: <CALkWK0mqkOZ__Gk-5VUpzLCaUHx1kA1JTrFunF3tUSeX6tDkgA@mail.gmail.com>
URL: https://gitlist.dev/e/CALkWK0mqkOZ__Gk-5VUpzLCaUHx1kA1JTrFunF3tUSeX6tDkgA%40mail.gmail.com
In-Reply-To: <87sj12rt13.fsf@yahoo.fr>

```
Nicolas Richard wrote:
> - A '*' can be used both in src and dest, and it matches any name,
>   including subdirectories, but not partial names (i.e. refs/heads/foo*
>   is invalid).
> - multiple fetch lines can be given in .git/config, each of them will be
>   obeyed
>
> These are probably obvious for most users, but I think documenting them
> would be good for newcomers. (I tried to come up with a patch but I
> can't find a precise yet concise way to explain the role of '*' in
> english.)

Good.  Yes, we don't even have examples showing that a rewrite like
refs/heads/nr/*:refs/heads/* can be done.  The documentation is
definitely lacking.  However, I'd urge you to get started by
submitting an initial draft: we will review it and help you learn and
contribute.  Some pointers:

- What you are attempting to document is called a refspec.  Look at
'struct refspec' in remote.h, and attempt to understand what its
fields mean by looking at how it is used in remote.c.

- Notice that there is a push refspec corresponding to the fetch
refspec.  This feature is even more obscure and undocumented.

- See remote.c:get_ref_match(); specifically,
match_name_with_pattern() is doing the pattern matching.  As you can
see, match_name_with_pattern() hard-codes a '*' and tries to match
just that: there is no support for anything else.  Try to skim through
the code once.

- Read Documentation/SubmittingPatches and submit a first version
quickly.  It doesn't have to be perfect at all.

```
