1

Is there a way to have Eclipse (egit plugin) to respect the .gitignore file in the root of the the local repo? Eclipse seems to prefer a .gitignore in each project, I have multiple projects in the repo so it's somewhat cumbersome to manage multiple ignore files.

Thanks

csilk
  • 188
  • 1
  • 15
  • The .gitignore should be configured per project. – Aleksandr M Jul 02 '14 at 10:12
  • having 60 gitignore files in my eclipse workspace hardly seems like a good solution (60 projects in the workspace). – csilk Jul 02 '14 at 22:53
  • We are talking about vcs after all. If somebody clones one of your project and it doesn't have .gitignore they eventually push something that should be ignored. – Aleksandr M Jul 03 '14 at 08:00
  • I don't know why someone would clone and build just one of the projects when it has dependencies across multiple other projects? Anyone working on this product would want to take a fair few of the other projects and would certainly want a gitignore file at the root of the workspace – csilk Jul 10 '14 at 01:18

1 Answers1

0

You can create global gitgnore file, say in ~/.gitignore, and then configure git to actually use it:

git config --global core.excludesfile ~/.gitignore

After that, all git related tools (including Eclipse) should use global .gitignore file.

Note that while EGit does not support all git features, this one is supported: http://wiki.eclipse.org/EGit/FAQ.

mvp
  • 111,019
  • 13
  • 122
  • 148
  • Seems to work. I'm assuming by global we're just talking within the context of the local repository and not every local repo I have on my machine? – csilk Jul 03 '14 at 05:00
  • Global really means global - effect of this .gitignore will be added to all git repositories you have on your computer now. This is actually good as far as I am concerned - for example, on Mac it is very helpful to have `.DS_Store` added to such global .gitignore – mvp Jul 03 '14 at 05:35
  • It's also bad because I don't want to ignore bin/ in every workspace. – csilk Jul 10 '14 at 01:19
  • Remember that .gitignore is [just a hint](http://stackoverflow.com/a/14037355/1734130) which you can override with `git add -f`. Effects of such global gitignore are added to effects of any local gitignore, so you will have to find a way to use what's most convenient for you. For example, `.DS_Store` and `*.bak` should be in global gitignore, and other rules should be set on a case by case basis – mvp Jul 10 '14 at 01:24