如何在git中为'private'分支配置命名空间? [英] How to config namespace for 'private' branches in git?
问题描述
是否有可能将git存储库配置为不从默认情况下从源存储库的某些名称空间获取分支?
我想要将我目前的工作放在一些命名空间,以便其他人知道它尚未准备好。例如,如果我像这样配置命名空间 a
:
[remote origin]
fetch = + refs / heads / *:refs / remotes / origin / *
fetch = + refs / heads / a / *:refs / remotes / origin / a / *
push = + refs / heads / a / *:refs / heads / a / *
url = some_git_url
其他人有 fetch = + refs / heads / *:refs / remotes / origin / *
行但不是 fetch = +参考文献/头/一个/ *:参/遥控器/产地/一个/ *
。当然,他们可以从我的 / a /
命名空间中获取分支。但我希望这种情况不会在默认情况下发生,以便我的工作提交不会混淆其他人的历史图。 问题是它似乎 refs / heads / *
包含嵌套的命名空间。因此,当我在任何机器上执行 git fetch
时,我仍然从 / a /
命名空间获取所有内容。
有没有办法像我想要的那样配置git?告诉git只从 refs / heads /
?获取直接分支。
<保持您的工作分支机构在本地,只推送共享分支机构。要求其他人也这样做。
假设你们都是以远程方式共享一个中央存储库,而不是互相推送/拖放对方的本地存储库。 / p>
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 = +refs/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.
这篇关于如何在git中为'private'分支配置命名空间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!