简体   繁体   English

Git:将特定文件从一个存储库中的一个分支移动到另一个存储库中的另一个分支

[英]Git: Move specific files from one branch in one repository to another branch in another repository

We have 1000s of autocad drawing files in, let's say Repo A, Branch1. 我们有1000个autocad绘图文件,比如Repo A,Branch1。 Also, it contains other files. 此外,它还包含其他文件。 We pull this repository and after some steps, they are pushed to Repo B, Branch 2. The cumulative size is around 2GB and it takes lot of time to pull Repo A and commit to Repo B. 我们拉出这个存储库,经过一些步骤后,它们被推送到Repo B,Branch 2.累积大小约为2GB,需要大量时间来提取Repo A并提交Repo B.

My questions are 1. Is there a way to copy, not move, the latest commit in Repo A Branch1 to Repo B Branch 2, in a lesser span of time? 我的问题是1.有没有办法在较短的时间内复制,而不是移动Repo A Branch1中的最新提交到Repo B Branch 2? 2. Would like to copy only the specific file types, not all the files. 2.只想复制特定的文件类型,而不是所有文件。

Since I assume the files you are committing are of a binary type, then no, I don't believe there are any shortcuts from Git's perspective here. 因为我假设您提交的文件是二进制类型,然后不,我不相信Git的观点有任何捷径。

A commit in Git is a defined unit and cannot be broken up...if it was broken up then it would need a new identifier (sha) since they are generated based on the content of the commit plus it's parent commit. Git中的提交是一个已定义的单元,不能被分解......如果它被分解,那么它将需要一个新的标识符(sha),因为它们是根据提交的内容加上它的父提交生成的。

The only option I can think of would be to check in your files using some type of compression but that would be abstracted away from Git's perspective. 我能想到的唯一选择是使用某种类型的压缩来检查你的文件,但这将从Git的角度抽象出来。

Also, Git may not be the best tool for this type of storage. 此外,Git可能不是这种类型的存储的最佳工具。 While Git can handle binary files it is mostly tailored towards storing text files that can be efficiently diffed. 虽然Git可以处理二进制文件,但它主要用于存储可以有效区分的文本文件。

如果repo B的主机可以访问repo A的主机,那么你可以在B上设置一个遥控器,这样你就可以直接将A的变化拉到B.

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

相关问题 如何将分支从一个存储库移动到不同存储库的另一个分支 - How to move branch from one repository to another branch of different repository 一个存储库中的Git master分支,另一个私有存储库中的另一个分支 - Git master branch in one repository and another branch on another private repository Git从一个分支移动到另一个分支 - Git move from one branch to another branch 将现有分支从一个存储库合并到新存储库的另一分支 - Merging an existing branch from one repository to another branch of a new repository 在 Github 中将特定文件从一个分支移动到另一个分支 - Move Specific Files from One Branch to Another Branch in Github GIT 如何将更改从一个存储库的分支拉到另一个存储库的分支 - GIT how to pull changes from a branch in one repository into a branch of another repository 如何将文件从一个 git 分支移动到另一个分支 - How to move files from one git branch to another 如何将目录从一个存储库推送到另一个存储库的主分支? - How to push a directory from one repository to the master branch of another repository? 将gh-pages分支从一个存储库复制到另一个存储库 - Copying gh-pages branch from one repository to another repository 如何将git存储库镜像到另一个的特定分支? - How to mirror a git repository to the specific branch of another?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM