2

I've edited a file in my java program and pushed it to a branch called 'develop'.

I added a line changing it from:

    else 
        message = guess + " is correct. You win!";

To:

    else {  
        message = guess + " is correct. Let's play again!";
        newGame();
    }

After I push to the develop branch this is what I see in github:

    else {  
           message = guess + " is correct. Let's play again!";
        newGame();
    }

Not that it matters for Java. But the indentation is off. Why would there be a difference in what I see in github from what I pushed and what I see in my eclipse IDE? Exclipse is set to the correct branch I pushed to.

bluethundr
  • 1,005
  • 17
  • 68
  • 141
  • 1
    Looks like you are using mixed tabs and spaces for indentation. Tabs can be displayed with different amounts of spaces. – mkrieger1 Dec 16 '20 at 19:18
  • [related](https://stackoverflow.com/q/17527819/1256452); see also [Tabs vs Space indentation](https://stackoverflow.com/q/11492179/1256452) – torek Dec 17 '20 at 06:26

1 Answers1

2

I think this similar to here. Basically, you should probably switch Eclipse to use spaces instead of tabs since, as @mkrieger1 said, tabs can be rendered differently. Spaces will be more consistent between systems.

You may also have to update the formatter settings: Window -> Preferences -> Java -> Code Style -> Formatter

Create new profile and then click "Edit": Indentation -> Tab policy

Dan Csharpster
  • 2,662
  • 1
  • 26
  • 50