Git - 推动一个大型项目的远程分支非常缓慢 [英] Git - pushing a remote branch for a large project is really slow

查看:324
本文介绍了Git - 推动一个大型项目的远程分支非常缓慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们只是在努力工作。我们有一个相当大的项目,在版本控制下有相当大的资源(〜500MB)。

今天,我们试图将一个分支推送到远程服务器,并感到惊讶的是,git似乎试图上传整个项目。我会希望git只发送已更改的4-5个文本文件的变化量(就像正常推送到主文件一样)。这不是远程分支机构的工作原理吗?我们使用 git push origin some_branch_name ,在这种情况下是否有更好的命令?我们不应该在git中存储大量资源吗?如果不是,人们通常如何处理这种情况?有没有更好的方法让一个开发人员与另一个开发人员共享正在进行的工作,而不必将更改提交给主分支?就目前而言,我们正在大约15分钟左右推动一个远程分支,这是不可行的。我们做错了什么?

解决方案



为了更好地了解您的项目的外观,请张贴以下前10+条:

  git log --decorate = short --oneline --graph --all 

如果大的资源是二进制文件,那么不应该将它们存储在git中。如果这些二进制资源被更新,然后git,那么它必须在内部完成它们的复制,这是压缩算法不喜欢的,并将它们发送到服务器。至于如何处理它们,则取决于场景。你需要详细说明。



听起来好像你有几个开发人员在同一个远程工作。它是否正确?如果是这样,没有开发人员应该直接提交给 master (不管怎样,imho永远不会发生)。每个开发人员都有可能拥有自己的命名分支。例如,开发人员John可以在 john /< branch_name> 下创建所有分支。这将有助于保持工作流的清洁。



另外,git不适用于deltas。它每次更改时都会存储整个文件。这似乎效率不高,但使用的压缩将尺寸降到最低。它可以帮助结账和扫描日志历史更快。阅读 Git Basics 的第一部分以获取可视化效果。


We're just moving to git at my work. We have a reasonably large project with some fairly large resources under version control (~500MB).

Today we tried to push a branch to a remote server and were surprised that git seemed to be trying to upload the entire project. I would have expected git to only send the deltas for the 4-5 text files that had changes (like it does for a normal push to master). Is this not how remote branches work? We used git push origin some_branch_name, is there a better command to use in this case? Should we not be storing large resources in git? If not, how do people usually handle this scenario? Is there a better way for one developer to share in-progress work with another developer w/o committing the changes to the master branch? As it stands, we're looking at around 15 min to push a remote branch, which is really not workable. What are we doing wrong?

解决方案

Can you update your post with a few things?

To get a better idea of how your project looks, please post around the top 10+ entries of the following:

git log --decorate=short --oneline --graph --all

If the large resources are binaries, then no they should not be stored in git. If those binary resources are updated then git then it has to make a complete duplicate of them internally, which the compression algorithm doesn't like, and send those up to the server. As for what to do about them, that depends on the scenario. You'll need to elaborate.

It sounds like you have several developers working on the same remote. Is this correct? If so, no developer should be committing directly to master (imho should never happen anyways). It's possible for each developer to have their own named branch. For example, developer John can create all his branches under john/<branch_name>. This will help keep the workflow clean.

Also, git doesn't work with deltas. It stores the file in its entirety each time it's changed. This may seem inefficient, but the compression used keeps size down to a minimum. And it helps checkouts and scanning log history much faster. Read the first section of Git Basics for a visualization.

这篇关于Git - 推动一个大型项目的远程分支非常缓慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆