1

I have a bit of an issue and I need to trick git.

Basically I have a repo that I share with another programmer who is in a place where internet is very slow. This repo has a lot of images, and they rarely change. Anyway so I shared this repo with the other programmer, and he downloaded it, after which something happened and I had to close the repo down. I did some minor code changes on the repo and uploaded it again, and I want the other programmer to be able to work on it. now he has a copy of that repo but some files are out of sync, but the images are the same ( 95% of the repo size is images ). His local copy doesn't have any git symbols. How can I have him trick git into thinking that he just has an old version of the remote repo, so he can get only the code changes but not have to download the entire repo again?

To Clarify:

the new repo is not the same as the old repo, its the same codebase, but not the same commit objects or hashes.

4

2 回答 2

2

如果内容相同,那么他只需要提交对象。这很容易。

mkdir for-my-buddy
git rev-list --all \
        | git pack-objects for-my-buddy/pack

通过电子邮件将目录的内容发送给他,让他将这些内容放入 .git/objects/pack 中,git branch -m / git tag -f 他的 refs 到你的,然后你就完成了。

编辑:你可以通过做安全和便宜的实验

git clone -s path/to/real/repo path/to/playground/repo

在操场上做所有的工作。当你满意时,把工作推过去。

于 2013-11-08T02:22:08.577 回答
0

最简单的是将您的目录与他的目录同步。git repo 只是一堆文件——它没有任何保持状态的运行时逻辑。

如果 repos 在技术上完全不同,并且您不关心旧 repo 的历史数据,请告诉他.git在与您的 rsync 之前删除目录。如果您关心旧仓库的历史记录,请告诉他备份他的目录,然后.git在将他的目录与您的同步之前删除该目录。

于 2013-11-08T01:56:45.483 回答