Re: Ignoring remote branches.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Steven,

Steven Michalske wrote:

> I want to track new branches, so specifying the branches I want
> to fetch is tedious.
> 
> Any workarounds to ignore all branches that match *.stgit

I would suggest using ‘git ls-remote’ and ‘git fetch’ to grab just the
branches you want.

  #!/bin/sh
  set -e

  : ${remote=origin}
  : ${options=--dry-run}
  script='!/\.stgit$/ s'
  script="${script}#.*\\trefs/heads/\\(.*\\)\$"
  script="${script}#git fetch $options $remote "
  script="${script} refs/heads/\\1:refs/remotes/$remote/\\1"
  script="${script}#p"

  eval "$(git ls-remote "$remote" | sed -n "$script")"

I am not sure how to generalize this: a pre-fetch hook that can reject
some branch names?  a fetchregexp configuration item?

 [remote "origin"]
	url = git://git.example.com/repo.git/
	fetchregexp = "refs/heads/\([^.]*\):refs/remotes/origin/\1"

Maybe we can solve some similar problems at the same time.

Thanks,
Jonathan
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]