git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: fetch branch blacklist

From
Jakub Narebski <jnareb@gmail.com>
Date
Jan 9, 2009, 20:23 UTC
Message-ID
<m3wsd41b7q.fsf@localhost.localdomain>
In-Reply-To
<87r63ek6cw.fsf@jidanni.org>
jidanni@jidanni.org writes:
Show 19 quoted lines
> 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
Previous: jidanni@jidanni.orgNext: jidanni@jidanni.org
Message 2 of 3 in “fetch branch blacklist”
  1. jidanni@jidanni.orgJan 8, 2009
  2. Jakub NarebskiJan 9, 2009
  3. jidanni@jidanni.orgJan 10, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.