简体   繁体   English

一个git分支可以在同一远程中另一个膨胀吗?

[英]Can one git branch bloat another in the same remote?

I have a git repository with a master branch on the origin remote. 我在origin远程上有一个git存储库和一个master分支。 Other devs on the team are pushing their own dev/feature branches to the same remote. 团队中的其他开发人员正在将自己的dev/feature分支推送到同一远程。 Eventually these branches will either be discarded, or squash -merged into master and later deleted. 最终,这些分支要么被丢弃,或壁球 -merged到master后来删除。

Now some devs on the team are unfamiliar with git and are likely to bloat the history of their feature branches by adding binary files, etc. Eventually they will send a pull review request, which must be reviewed, and reviewers will enforce that no binaries are added. 现在,团队中的一些开发人员不熟悉git,并且可能会通过添加二进制文件等来夸大其功能分支的历史。最终,他们将发送请求审查请求,必须对其进行审查,并且审查者将强制要求没有二进制文件。添加。

In this scenario, I expect the dev/feature branches to be bloated (eg git might become slow, pulling/cloning them might take a while, etc). 在这种情况下,我预计dev/feature分支会肿(例如git可能会变慢,拉/克隆它们可能需要一段时间,等等)。 The question is whether this will cause any performance issues for people just working with other branches in the same remote that are not bloated. 问题是,这是否会对仅与同一远程中未膨胀的其他分支一起工作的人员造成任何性能问题。

The question is whether this will cause any performance issues for people just working with other branches in the same remote that are not bloated. 问题是,这是否会对仅与同一远程中未膨胀的其他分支一起工作的人员造成任何性能问题。

If the bloated branches are pushed, yes, it will impact other's performance, but only for git fetch (which includes git pull ). 如果将the肿的分支推入,是的,它将影响其他人的性能,但仅适用于git fetch (包括git pull )。 It will download the whole history and full content of every branch by default. 默认情况下,它将下载每个分支的全部历史记录和全部内容。 There are various ways around this, like git clone --single-branch to get only master , but there's a better solution below. 有多种解决方法,例如git clone --single-branch只获得master ,但是下面有一个更好的解决方案。

But it should not affect other operations. 但这不应影响其他操作。 git diff , git log , etc... should all be largely unaffected. git diffgit log等都应该在很大程度上不受影响。

Rather than preventing people from putting binaries in version control, or cloning only certain branches, use git-lfs . 使用git-lfs而不是阻止人们将二进制文件放入版本控制中或仅克隆某些分支。 This is the best of both worlds. 这是两全其美。 You can put binary files in version control, but the actual content is stored outside the repository to avoid repository bloat. 您可以将二进制文件放入版本控制中,但实际内容存储在存储库外部,以避免存储库膨胀。

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

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