开发者

How to config namespace for 'private' branches in git?

Is it possible to config git repository not to fetch branches from certain namespaces of the origin repository by default?

What I want is to put my current work in some namespace so that everyone else know it is not ready yet. For example, if I config namespace a like that:

[remote "origin"]
    fetch = +refs/heads/*:refs/remotes/origin/*
    fetch = +r开发者_如何学编程efs/heads/a/*:refs/remotes/origin/a/*
    push = +refs/heads/a/*:refs/heads/a/*
    url = some_git_url

Others would have fetch = +refs/heads/*:refs/remotes/origin/* line but not fetch = +refs/heads/a/*:refs/remotes/origin/a/*. Of course they can fetch branch from my /a/ namespace. But I want that not to happen by default so that my working commits don't clutter others' history graphs.

The problem is that it seems refs/heads/* includes nested namespaces. So when I do git fetch on any machine - I still get everything from /a/ namespace.

Is there a way to config git like I want? To tell git to fetch only immediate branches from refs/heads/?


Keep your working branches locally and only push the shared branches. Ask others to do the same.

That's assuming you're all sharing a central repository as a remote, rather than pushing/pulling to and from each other's local repositories.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜