合并来自git仓库之外的更改 [英] Merging in changes from outside a git repository
问题描述
我正在与该国另一方的另一位开发人员一起工作,他们是我们项目的负责人,而且没有使用正式的版本控制系统。在我的最后,我正在用git跟踪所有的代码。我最近开始为主项目做出贡献,并希望能够跟踪其他开发人员的更新。
当我收到他更新的代码时,它是通常采用zip文件的形式。如果我简单地将文件解压缩到我的git工作文件夹中,git认为每个文件都已更改,可能是因为stat信息已更改。
我想看看是一种可以将我的工作副本旁边的新代码解压缩的方法,并且仅合并更改。什么是最好的方法来做到这一点?由于这是一个Powerbuilder项目,所以大部分文件都是二进制文件。
谢谢!
所以:你需要这些二进制文件,还是可以你重建它们?
至于源代码,在Git中, SHA1为王,自文件日期(时间戳)参与其计算以来的 感谢 rq 指出时间戳不是SHA1计算的一部分。 是 SHA1计算:替代文字http://alexgirard.com/git-book/assets/images/figure/object-blob.png 然而,当将大量外部管理的文件导入到git存储库时,即使旧的git托管文件没有更改,您也有可能将新文件添加到git托管的目录中,更改它们的内容,即SHA1密钥。 alt text http:// a lexgirard.com/git-book/assets/images/figure/object-tree.png 上述过程只是确保外部 em>方法来检测外部组文件和git管理的一组文件之间的变化,并判断它是否必须是git工作目录的一部分。 I'm working with another developer on the other side of the country who is the lead on our project, and isn't using a formal version control system. On my end, I'm tracking all of my code in git. I've recently started contributing to the main project, and would like to be able to track updates from the other developer as well. When I receive his updated code, it's usually in the form of a zip file. If I simply unzip the file into my git working folder, git believes that every file has changed, presumably because the stat info has changed. What I'd like to see is a way that I can unzip the new code alongside my working copy, and merge in only the changes. What's the best way to do this? As it's a Powerbuilder project, most of the files are binaries. Thanks! The binaries, if stored in Git, are bound to create a new version (i.e. to be taken into account at the next commit). As for the sources, in Git, SHA1 is king, and Thanks to rq for pointing out that timestamps are not part of SHA1 computation.
Only the: are part of SHA1 computation: alt text http://alexgirard.com/git-book/assets/images/figure/object-blob.png However, when importing large set of files externally managed into a git repository, you risk adding new files into git-managed directories, changing their content, hence their SHA1 key, even though old git-managed files have not changed. alt text http://alexgirard.com/git-book/assets/images/figure/object-tree.png The above process just ensure an external way to detect what has changed between an external set of files and a git-managed set of file and judge if it has to be part of the git working directory or not. 这篇关于合并来自git仓库之外的更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!,因为外部集的文件在其内容(更多文件,临时文件,应该忽略的文件...)上可能有很大不同,最好是:
您只需比较两组目录和文件:解压缩远程同事的开发以及当前正在工作的那一个。
只有:
这意味着如果这些新文件只是临时文件或者应该被忽略/重新创建/重新生成的文件,那么树中的很多更改都是虚假的。
So: do you need those binaries, or can you rebuild them ?since the date of the file (timestamps) is involved in its calculation, since the external set of files can be fairly different in its content (more files, temporary files, files that should be ignored, ...), it would be best to:
You just compare the two set of directories and files: the one where you have unzipped the development of your far-away colleague, and the one in which you are currently working.
That means a lot of changes in tree are artificial if those new files are just temporary files or files that should be ignored/recreated/regenerated anyway.