{"thread":{"id":"23775","subject":"Ignoring remote branches.","startedAt":"2010-05-11T07:40:43Z","lastAt":"2010-05-12T10:25:12Z","messageCount":2,"participants":["Steven Michalske","Jonathan Nieder"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"141461","messageId":"9F4F3DE1-59FE-4D27-A40E-81856BF95C9D@gmail.com","threadId":"23775","inReplyTo":null,"subject":"Ignoring remote branches.","fromName":"Steven Michalske","fromEmail":"smichalske@gmail.com","sentAt":"2010-05-11T07:40:43Z","receivedAt":"2010-05-11T07:40:43Z","isPatch":false,"sender":{"key":"smichalske@gmail.com","avatar":"https://gravatar.com/avatar/721f27456adc9ac84f3bb235f021a70015abb9e09222ae8622fc5579c6a203c1?d=mp&s=160"},"body":"Howdy,\n\nI would like to know a way to exclude fetching stacked git branches  \nfrom repositories.\n\nBut I want to track new branches, so specifying the branches I want to  \nfetch is tedious.\n\nAny workarounds to ignore all branches that match *.stgit\n\nSteve\n"},{"id":"141520","messageId":"20100512102512.GA17810@progeny.tock","threadId":"23775","inReplyTo":"9F4F3DE1-59FE-4D27-A40E-81856BF95C9D@gmail.com","subject":"Re: Ignoring remote branches.","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-05-12T10:25:12Z","receivedAt":"2010-05-12T10:25:12Z","isPatch":false,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Hi Steven,\n\nSteven Michalske wrote:\n\n> I want to track new branches, so specifying the branches I want\n> to fetch is tedious.\n> \n> Any workarounds to ignore all branches that match *.stgit\n\nI would suggest using ‘git ls-remote’ and ‘git fetch’ to grab just the\nbranches you want.\n\n  #!/bin/sh\n  set -e\n\n  : ${remote=origin}\n  : ${options=--dry-run}\n  script='!/\\.stgit$/ s'\n  script=\"${script}#.*\\\\trefs/heads/\\\\(.*\\\\)\\$\"\n  script=\"${script}#git fetch $options $remote \"\n  script=\"${script} refs/heads/\\\\1:refs/remotes/$remote/\\\\1\"\n  script=\"${script}#p\"\n\n  eval \"$(git ls-remote \"$remote\" | sed -n \"$script\")\"\n\nI am not sure how to generalize this: a pre-fetch hook that can reject\nsome branch names?  a fetchregexp configuration item?\n\n [remote \"origin\"]\n\turl = git://git.example.com/repo.git/\n\tfetchregexp = \"refs/heads/\\([^.]*\\):refs/remotes/origin/\\1\"\n\nMaybe we can solve some similar problems at the same time.\n\nThanks,\nJonathan\n"}]}