简体   繁体   English

自动转换 git 存储库

[英]Transforming a git repo automatically

Summary: is it possible to easily mirror a remote branch while also applying a transformation to it?摘要:是否可以轻松地镜像远程分支,同时对其进行转换?

Detail: The official Arch package repo holds configuration in a folder per package:详细信息:官方 Arch package repo 将配置保存在每个 package 的文件夹中:

https://github.com/archlinux/svntogit-community/tree/master/a2jmidid/trunk https://github.com/archlinux/svntogit-community/tree/master/a2jmidid/trunk

It is also set up to have a branch per package which seems to point to the same place:它还设置为每个 package 有一个分支,这似乎指向同一个地方:

https://github.com/archlinux/svntogit-community/tree/packages/a2jmidid/trunk https://github.com/archlinux/svntogit-community/tree/packages/a2jmidid/trunk

As the repo is quite large and I'm only interested in specific packages, I'm looking for a way to track specific parts of the repo, in order to fork further.由于 repo 很大而且我只对特定的包感兴趣,我正在寻找一种方法来跟踪 repo 的特定部分,以便进一步分叉。 I'm also just interested in the trunk folder.我也只是对主干文件夹感兴趣。

Ideally I want to end up with a repo for the above that can be accessed with:理想情况下,我希望最终得到一个可以通过以下方式访问的 repo:

Git://localserver/packages/a2jmidid.git Git://localserver/packages/a2jmidid.git

Where cloning the above ends up with the contents of the trunk folder (and related history) of the specific package.克隆上述内容的最终结果是特定 package 的主干文件夹(和相关历史记录)的内容。

I have used --mirror for similar before, but only for full repos and their many branches.我以前用过 --mirror 类似的东西,但只用于完整的 repos 和它们的许多分支。 I suspect it's worth leveraging the package branch (vs the folder in master), but I can't see how to mirror just a single branch.我怀疑值得利用 package 分支(与 master 中的文件夹相比),但我看不到如何只镜像一个分支。 That also wouldn't reduce the repo to just the trunk folder.这也不会将 repo 减少到仅主干文件夹。

I've tried just cloning and copying the files I'm interested in, but that doesn't persist the history.我试过克隆和复制我感兴趣的文件,但这并没有保留历史。

I think the approach should be to clone, branch and delete/move the files around, and then in future pull/merge and commit, but I'm having trouble nailing the exact workflow.我认为该方法应该是克隆、分支和删除/移动文件,然后在将来拉/合并和提交,但我无法确定确切的工作流程。 The intention is to schedule this update.目的是安排此更新。

After the first step of just checking out the single branch (as per @Frodon), you can actually split out a subfolder into its own branch:在仅检查单个分支的第一步之后(根据@Frodon),您实际上可以将一个子文件夹拆分为它自己的分支:

git subtree split -P trunk/ -b trunks/a2jmidid

This can then be pushed as you want.然后可以根据需要推送。

Credit here信用在这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 自动将git仓库中的目录推送到另一个仓库 - Push a directory in a git repo to another repo automatically 如何自动git自动克隆服务器上的repo? - How to automate git to automatically clone a repo on the server? 将数据推送到裸git仓库时,如何自动将数据推送到git-repo? - How can I automatically push the data to a git-repo when it's pushed to a bare git repo? 只要将更改提交到gerrit的git repo中,就会自动更新远程git repo - automatically update remote git repo whenever change is submitted into gerrit's git repo 如何自动将所有符号链接转换为repo中的git子模块 - How to convert automatically all symlink to git submodules in repo 如何制作git note以便为克隆回购协议的每个人自动提取? - How to make git notes to pull automatically for everyone who clones repo? 如何根据远程仓库的URL自动设置git:username - How to set git:username automatically based on URL of remote repo Git-如何在仓库中自动推送未跟踪的文件 - Git - how to push untracked (ignored) file in repo automatically Git 别名在克隆时自动为个人回购信息添加前缀? - Git alias to prefix personal repo information automatically on clone? 在永远不会提交的 git 存储库之上自动添加本地更改 - Automatically adding local changes on top of a git repo that are never to be committed
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM