简体   繁体   中英

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. 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.

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? 2. Would like to copy only the specific file types, not all the files.

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.

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.

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.

Also, Git may not be the best tool for this type of storage. While Git can handle binary files it is mostly tailored towards storing text files that can be efficiently diffed.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM