如何将特定文件仅推送到一个遥控器?

问题描述 投票:0回答:1

我有 git 存储库和 2 个遥控器。 .git/config 看起来像

[remote "primary"]
    url = ssh://[email protected]/projectname/android.git
    fetch = +refs/heads/*:refs/remotes/primary/*
[branch "develop"]
    remote = primary
    merge = refs/heads/develop
[remote "secondary"]
    url = [email protected]:projectname/android.git
    fetch = +refs/heads/*:refs/remotes//*
[remote "origin"]
    url = ssh://[email protected]/projectname/android.git
    fetch = +refs/heads/*:refs/remotes/origin/*
    pushurl = ssh://[email protected]/projectname/android.git
    pushurl = [email protected]:projectname/android.git

git.secondary.com 是本地 Forgejo(gitea fork) 实例。我有它的管理员访问权限。 git.primary.com 是公司仓库。我只有分支的写权限,需要遵循一些规则

我需要 git.secondary.com 上的存储库在特定的 subolder (.forgejo/) 中包含几个附加文件,这些文件不应推送到 git.primary.com。 我需要它来自动运行测试并执行一些自动分析

我怎样才能做到这一点?

git
1个回答
0
投票

没有有效的方法可以做到这一点,因为 git 并不是为此而设计的。只有破解它 设置一个名为 test 的分支 运行:

git push secondary test

对于您本地的开发者

当您计划将更改合并到主要 首先使用 git diff 工具将更改合并到 master(在本地机器中)(不要合并 .forgejo/ 文件夹)如何执行此操作取决于您使用的 diff 工具 然后

git puch primery master
© www.soinside.com 2019 - 2024. All rights reserved.