Github上Java Eclipse项目的奇怪缩进 [英] Strange indenting for Java Eclipse project on Github
问题描述
上,由于某种原因,缩进是一团糟。我不确定发生了什么事情?
谢谢 如果这些缩进问题在git推送到GitHub后反映回代码中,您可以使用以下命令:
.gitattributes
文件的过滤器内容驱动程序(如 git可以自动切换空格和制表符?)
这两个自动机制可以解释 git commit
中的更改。
但是,如果您的代码在本地后看起来不错,那么git push会显示在GitHub上没有问题,那么你必须在本地正确渲染空间和标签的组合,并在GitHub上以不同方式呈现。
$ b 正如缩进问题使用崇高的文字2 :
问题不是硬标签,问题是混合空格和制表符用于缩进。
Everything is good in Eclipse, indenting is fine. Then I put my code on github and for some reason the indenting was a mess. I am not sure what is going on?
Thanks
If those indentation issues are reflected back in your code after a git push to GitHub, you either have:
- a hook removing spaces before tab (as in "Make git automatically remove trailing whitespace before committing")
- or a filter content driver declared ina
.gitattributes
file (as in "Can git automatically switch between spaces and tabs?")
Those are the two automatic mechanisms that could explain a change during the git commit
.
But if your code looks fine locally after the git push, but looks not fine on GitHub, then you must have a combination of space and tabs correctly rendered locally, and rendered differently on GitHub.
As mentioned in "Indentation issue using sublime text 2":
The problem is not hard tabs, the problem is mixing spaces and tabs for indentation.
这篇关于Github上Java Eclipse项目的奇怪缩进的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!