Jes
Jes

Reputation: 343

Github changes indentation

I've pushed my code in Ruby to remote Github repository. My code looks completely different now - in Sublime text it was perfectly fomatted, 2 spaces indentation as it should be in Ruby for every logical level. But on Github it's all over the place. What's the reason for it and what can I do to have my code exactly the same as locally?

Upvotes: 0

Views: 2000

Answers (1)

nzajt
nzajt

Reputation: 1985

I have had this issue before, but, it isn't with GitHub, it is with your code. If you use a tab and tell Sublime show it as 2 spaces it is still passing \t and not \s\s in the code.

The real solution is to us spaces \s instead of tabs \t, you can easily change a tab to 2 spaces in Sublime, Vim, Text-mate or whatever you want to use. Then the formatting will look the same for everyone and on all platforms.

The Sublime docs for tabs to spaces. https://www.sublimetext.com/docs/2/indentation.html

Also check out this question for more about tabs in Github. How to change tab size on GitHub?

Upvotes: 1

Related Questions