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!

This entry was posted in New Features and tagged , , . Bookmark the permalink.

8 Responses to Better Line Endings Managing in IntelliJ IDEA 12

  1. Ricky Clarkson says:

    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. Geoffrey De Smet says:

    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. Kirill Likhodedov says:

    @Geoffrey
    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. Daniel says:

    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. Kirill Likhodedov says:

    @Daniel
    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. Ben says:

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

  7. Kirill Likhodedov says:

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

  8. Lidia says:

    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?

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">