Wednesday, January 25, 2012

Git and NetBeans 7.1 Problem: Everything in the project appears modified, but is not

Hi,

Recently I started developing a new Symfony2 project on Windows following the tutorial on http://tutorial.symblog.co.uk

I like to use Git in combination with BitBucket.org. I used Git integrated in NetBeans in combination with msysGit and recently found a very strange bug. Everything in NetBeans appeared as modified but actually wasn’t. Very strange I thought, and created an issue on NetBeans bugzilla, than I found out that it is a duplicate of the other issue http://netbeans.org/bugzilla/show_bug.cgi?id=198451.

It appeared to be a problem related to line endings in different operating systems. Though msysGit is capable of ignoring this differences, it seems to be that JGit, the tool on which integration with Git is made in NetBeans, doesn’t. So now what should we do to make it work is to add the line

[core] autocrlf = false

to project’s .git/config file. But that’s not enough, also we would need to follow the instructions in http://help.github.com/line-endings/.

So for Windows I needed to run this script in msysGit :

# Remove everything from the index
$ git rm --cached -r .

# Re-add all the deleted files to the index
# You should get lots of messages like: "warning: CRLF will be replaced by LF in <file>."
$ git diff --cached --name-only -z | xargs -0 git add -f

# Commit
$ git commit -m "Fix CRLF"

Hope this one will save you time and please vote it in NetBeans bugzilla to notify developers that we need it solved. 

2012-01-24_1436For any ideas, concerns, requests please leave a comment. Thank you.

No comments:

Post a Comment