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

Re: Restraining git pull/fetch to the current branch

From
Shawn O. Pearce <spearce@spearce.org>
Date
Jan 12, 2007, 00:59 UTC
Message-ID
<20070112005921.GE23864@spearce.org>
In-Reply-To
<Pine.LNX.4.64.0701112127000.12870@beast.quantumfyre.co.uk>
Julian Phillips <julian@quantumfyre.co.uk> wrote:
Show 13 quoted lines
> While trying out git on a large repository (10000s of commits, 1000s of 
> branches, ~2.5Gb when packed) at work I noticed that doing a pull was 
> taking a long time (longer than I was prepared to wait anyway).
> 
> A quick test showed that a small repository (1 commit, 24k .git/objects) 
> with 1000 branches took 1m30 to do "git pull" (local xfs partition).  I 
> don't know if this is reasonable or not, but all I actually cared 
> about was updating the current branch, which "git pull origin 
> <branch_name>" did in 0.3s.
> 
> So what I would like to know is: is there any way to make a pull/fetch 
> with no options default to only fetching the current branch? (other than 
> scripting "git pull/fetch origin $(git symbolic-ref HEAD)" that is)
No, but fortunately bash has a fancy alias tool:
	alias gp='git pull origin $(git symbolic-ref HEAD)'
perhaps your shell can help.  :-)

Life is going to be painful with that repository with current Git (1.5.0 and later) as the new default configuration for a clone is to copy every branch into refs/remotes/origin/*, where * is wildcarded against the current set of branches on the remote repository. If that takes "a long time" you will be processing a lot of refs you don't care about (or need to care about).

-- 
Shawn.
Previous: Julian PhillipsNext: Junio C Hamano
Message 2 of 5 in “Restraining git pull/fetch to the current branch”
  1. Julian PhillipsJan 11, 2007
  2. Shawn O. PearceJan 12, 2007
  3. Junio C HamanoJan 12, 2007
  4. Julian PhillipsJan 12, 2007
  5. Julian PhillipsJan 15, 2007

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.