# fetch branch blacklist

3 messages from 2009-01-08 to 2009-01-10. Participants: jidanni@jidanni.org, Jakub Narebski.
Thread: https://gitlist.dev/t/17041

## jidanni@jidanni.org, 2009-01-08 00:07

Subject: fetch branch blacklist
Message-ID: <87r63ek6cw.fsf@jidanni.org>
URL: https://gitlist.dev/e/87r63ek6cw.fsf%40jidanni.org

```
If one wants to always fetch all except one remote branch, one cannot
just blacklist it, but must instead whitelist all the rest.
$ git branch -rd origin/man origin/html
Deleted remote branch origin/man.
Deleted remote branch origin/html.
Plus I edited them out of FETCH_HEAD. Nonetheless, back from the dead:
$ git pull
From git://git.kernel.org/pub/scm/git/git
 * [new branch]      html       -> origin/html
 * [new branch]      man        -> origin/man
The only solution is to change .git/config:
[remote "origin"]
	url = git://git.kernel.org/pub/scm/git/git.git
#	fetch = +refs/heads/*:refs/remotes/origin/*
	fetch = +refs/heads/maint:refs/remotes/origin/maint
	fetch = +refs/heads/master:refs/remotes/origin/master
	fetch = +refs/heads/next:refs/remotes/origin/next
	fetch = +refs/heads/pu:refs/remotes/origin/pu
	fetch = +refs/heads/todo:refs/remotes/origin/todo
(Such explicit whitelisting will also sacrifice automatic addition or
even notification, if desired, of future new branches too.)
There is a remote.<name>.skipDefaultUpdate variable, but it probably
isn't fine grained enough.

```

## Jakub Narebski, 2009-01-09 20:23

Subject: Re: fetch branch blacklist
Message-ID: <m3wsd41b7q.fsf@localhost.localdomain>
URL: https://gitlist.dev/e/m3wsd41b7q.fsf%40localhost.localdomain
In-Reply-To: <87r63ek6cw.fsf@jidanni.org>

```
jidanni@jidanni.org writes:

> If one wants to always fetch all except one remote branch, one cannot
> just blacklist it, but must instead whitelist all the rest.
> $ git branch -rd origin/man origin/html
> Deleted remote branch origin/man.
> Deleted remote branch origin/html.
> Plus I edited them out of FETCH_HEAD. Nonetheless, back from the dead:
> $ git pull
> From git://git.kernel.org/pub/scm/git/git
>  * [new branch]      html       -> origin/html
>  * [new branch]      man        -> origin/man
> The only solution is to change .git/config:
> [remote "origin"]
> 	url = git://git.kernel.org/pub/scm/git/git.git
> #	fetch = +refs/heads/*:refs/remotes/origin/*
> 	fetch = +refs/heads/maint:refs/remotes/origin/maint
> 	fetch = +refs/heads/master:refs/remotes/origin/master
> 	fetch = +refs/heads/next:refs/remotes/origin/next
> 	fetch = +refs/heads/pu:refs/remotes/origin/pu
> 	fetch = +refs/heads/todo:refs/remotes/origin/todo

Well, you can always use hooks for that (see for example
underdocumented contrib/hooks/update-paranoid)... or you can try to
scratch that itch yourself.  gitignore supports inverse (negated)
patterns (!<pattern>), so there is some code dealing with
"blacklisting".  I would propose using the same '!' character, or
perhaps one of forbidden characters (see git-check-ref-format(1)),
i.e.

 [remote "origin"]
 	url = git://git.kernel.org/pub/scm/git/git.git
 	fetch = +refs/heads/*:refs/remotes/origin/*
        fetch = !refs/heads/html
        fetch = !refs/heads/man

-- 
Jakub Narebski
Poland
ShadeHawk on #git

```

## jidanni@jidanni.org, 2009-01-10 02:30

Subject: Re: fetch branch blacklist
Message-ID: <873afr6gfz.fsf@jidanni.org>
URL: https://gitlist.dev/e/873afr6gfz.fsf%40jidanni.org
In-Reply-To: <m3wsd41b7q.fsf@localhost.localdomain>

```
If anybody is going to implement this, then the order of the two lines
fetch=+refs/heads/*:refs/remotes/origin/*
fetch=!refs/heads/man
should probably matter...

```
