问题描述
我们有一个庞大而古老的代码库,需要大量的清理工作。我们一直都有编码标准,每个人都一直试图遵循它们,但是它们并没有被执行,所以随着时间的推移,很多违规行为已经蔓延开来。其中许多只是空白问题,例如使用制表符而不是空格或空格不应该有任何或应该是空位。我们将开始积极实施我们的编码标准,以确保更多的违规行为不会蔓延,但仅仅通过更改自动执行它们是很困难的,所以清理这些旧文件会很好。有些工具可以自动解决这些问题,但是如果我这样做,那么责备就会让我看到这些线的所有者,而实际上我可能永远都不会见过他们。我知道有一种设置可以忽略空白变化,但我不能让每个人都以同样的方式使用责任,包括其他可视化工具和gitstats之类的东西。在一个理想的世界里,有一些方法可以重写历史,看起来没有引入违规行为,没有掩盖谁介绍了实际的代码,但我找不到这样的东西。
git filter-branch
就是这样。
http://git-scm.com/docs/git-filter-branch
这与所有历史重写命令具有相同的问题,因为它实质上使所有克隆存储库无效。
We have a massive, ancient codebase that needs a lot of cleanup. We have always had coding standards and everyone has always tried to follow them, but they were not enforced so over time a lot of violations have creeped in. Many of them are just whitespace issues, like using tabs instead of spaces, or spaces where there shouldn't be any, or missing spaces where they should be. We are going to start actively enforcing our coding standards to make sure more violations don't creep in, but it's difficult to enforce them in an automated way on only the changes, so it would be nice to clean up these old files.
There are tools that can automate fixing these issues, however if I do that then blame is going to show me as the owner of those lines, when in reality I may never have even seen them. I know there is a setting to make blame ignore whitespace changes, but I can't make everyone use blame the same way, including other visual tools and things like gitstats. In an ideal world there would be some way to rewrite history to look like the violations were never introduced, without covering up who introduced the actual code, but I can't find anything like that.
git filter-branch
does precisely that.
http://git-scm.com/docs/git-filter-branch
This has the same issues as all history rewriting commands do, as it essentially invalidates all cloned repositories.
这篇关于git:改变样式(空格)而不改变所有权/责任?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!