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

Re: Feature Proposal: Track all branches from a given remote

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Oct 26, 2014, 00:16 UTC
Message-ID
<20141026001610.GK312818@vauxhall.crustytoothpaste.net>
In-Reply-To
<CAEFop41rvXCAawW7zWGzT251zWyyoMhQbg=5vtHzQrbk4W6D_Q@mail.gmail.com>
On Sat, Oct 25, 2014 at 04:34:30PM -0700, Scott Johnson wrote:
Show 8 quoted lines
> Hello git experts:
> 
> Recently, I've encountered the problem where I would like to set my
> local repository copy to track all branches on a given remote. There
> does not appear to be a switch for this in the git-branch command
> currently, however, I will admit that my somewhat limited
> understanding of the git-branch manpage might be causing me simply not
> to see it.

I don't know about a command line option for this, but I think there's a way to achieve what you're looking for.

Show 8 quoted lines
> So, for example, if I were to run:
> 
> git-branch --track-remote origin
> 
> and I had two branches on origin, master and maint, respectively,
> after the command finishes, my local repo would now have two branches,
> master (set up to track origin/master), and maint (setup to track
> origin/maint).
You could do something like this in .git/config:
[remote "origin"]
  fetch = refs/heads/*:refs/heads/*

You won't be able to fetch if you would overwrite the current branch, though.

-- 
brian m. carlson / brian with sandals: Houston, Texas, US
+1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only
OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187
Previous: Scott JohnsonNext: Scott Johnson
Message 2 of 4 in “Feature Proposal: Track all branches from a given remote”
  1. Scott JohnsonOct 25, 2014
  2. brian m. carlsonOct 26, 2014
  3. Scott JohnsonOct 26, 2014
  4. Andreas SchwabOct 26, 2014

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.