9

I like clean and simple files/code. So, I am using a global .gitignore depending on the machine settings ( IDE &|| OS Specific...). excerpt:

# exclude OSX Files
.DS_Store
# exclude Logfiles
*.log
# exclude Netbeans project files
/nbproject

Netbeans git support is improving and that's ok, but since 7.0 NB it is driving me crazy.

Every time I modify code in my project NB modifies the projects .gitignore as well and adding:

/nbproject

to the gitignore.

How do I stop Netbeans doing this, without deactivating the git support?

Jack B Nimble
  • 5,039
  • 4
  • 40
  • 62
dgAlien
  • 428
  • 1
  • 4
  • 9
  • 1
    Is this related to http://code.google.com/p/nbgit/issues/detail?id=74&q=gitignore&colspec=ID%20Type%20Status%20Priority%20Milestone%20Component%20Owner%20Summary? – VonC Jul 20 '11 at 11:48
  • Just a sidenote: The `.gitignore` is usually versioned and with this line you avoid, that _others_ may commit their workspace files (as long as they use netbeans). I would put `/nbproject` into `.gitignore`, but thats not part of this question :) – KingCrunch Jul 20 '11 at 12:30
  • 1
    I don't use Netbeans, but can you just add `.gitignore` to the .gitignore file? Or do you want the `.gitignore` to be in the repo because there are project-specific things you want to ignore? – Tyler Jul 21 '11 at 07:53
  • Sadly, there is no solution (yet). I need a project-specific ignore and dont want to add /nbproject to the repo.. maybe someone will fix that in the future? – dgAlien Jul 21 '11 at 10:07
  • 3
    Don't know much about how apps write to a file but could removing all write perms to the file possibly get the job done? – mohit6up Aug 20 '11 at 01:28
  • NetBeans projects store important project related data in /nbproject directory and it is recommended to commit this directory also to the source control. Only the /nbproject/private directory shall not be committed as it is user specific data. – Tushar Joshi Nov 10 '11 at 09:40

1 Answers1

1

As VonC said, this is an issue with the git module, not with anything you can do (except write a patch)

I recommend you star this issue: http://code.google.com/p/nbgit/issues/detail?id=74

And await a response.

Also, I am not too familiar with the source code, but you could do an inefficient workaround while you wait for a fix:

    private PathPatternList getRepoPatternList() {
        File gitInfoExclude = new File(new File(repo.getDirectory(), "info"), "exclude");
        return getPatternList(gitInfoExclude, "");
    }

Just edit the above with an if(gitInfoExclude==) and then put in the directory exception you want to add.

A T
  • 13,008
  • 21
  • 97
  • 158