Better Line Endings Managing in IntelliJ IDEA 12

It happens quite often, that version control is used by people working on different platforms. This is why problems with line endings may appear. If you ever read the article from GitHub, you might already know, that Git can automatically address these problems. You just need to set git config --global core.autocrlf true on Windows or git config --global core.autocrlf input on Linux and OS X.

However not everyone follows the instructions and setups VCS correctly. That’s why we have made a couple of improvements in IntelliJ IDEA 12 to make life easier.

The IDE will show you the difference in line endings in the Diff Dialog, so you can fix this easily. This feature works even, if you compare files not from a repository.

The second feature, we have added, is only available for Git repository now. It analyzes your configuration and warns you before commit, if you are about to commit CRLFs into the repository. The dialog will offer to set core.autocrlf setting for you.

Note, if you have set any related git attributes on a file with CRLFs, this file won’t be analyzed. You know what are you doing if you have set it.

You can try these features now in the latest IntelliJ IDEA 12 EAP .

Feel free to share your feedback and submit bugs you find in our issue tracker.

Develop with Pleasure!

Comments below can no longer be edited.

8 Responses to Better Line Endings Managing in IntelliJ IDEA 12

  1. Avatar

    Ricky Clarkson says:

    October 17, 2012

    That looks good, but I would add the option to make it possible per-repository instead of globally, i.e., with or without the –global option.

  2. Avatar

    Geoffrey De Smet says:

    October 18, 2012

    Does that warning ignore .bat files?
    We use LF everywhere, except in our .bat files.

    Does git attribute set for just that project or your entire git installation? Different projects might have different CR/LF conventions.

  3. Avatar

    Kirill Likhodedov says:

    October 18, 2012

    If you explicitly set or unset a git attribute (text, crlf, -crlf) on .bat files, it is ignored.

    “git config core.autocrlf true/input” is called globally. But if you don’t need it, you can easily disable the warning right in the dialog or in the Settings | Version Control | Git.

  4. Avatar

    Daniel says:

    October 18, 2012

    to be honest, the thing I would like most in the next version is stability.

    since upgrading to version 11, it can sit there and hang for a while. I use J2SE, Maven and SVN.

    In recent times, I’ve had to kill IntelliJ far too often

  5. Avatar

    Kirill Likhodedov says:

    October 18, 2012

    Please fire a request to our issue tracker (http://youtrack.jetbrains.com/issues/IDEA). Attach a thread dump there (http://devnet.jetbrains.net/docs/DOC-192). Thanks.

  6. Avatar

    Ben says:

    December 30, 2012

    Cool, but why isn’t this in PHPStorm? This has been killing us lately.

  7. Avatar

    Kirill Likhodedov says:

    January 2, 2013

    You may try a EAP of PhpStorm 6 (https://blog.jetbrains.com/webide/2012/12/phpstorm-6-eap-build-124-373/). It should have this functionality.

  8. Avatar

    Lidia says:

    May 29, 2013

    I’m using 12.1.1 with svn and have this problem with our testlist text files. For some reason, the issue has appeared only recently, i.e. in the last week or so. I can see that the testlist files contains CRLF characters in Diff Dialog, but the question is how do I change them into LF characters upon checking into svn?

Discover more