1

I'm using this .gitignore in the Jenkins directory:

*
!.gitignore
!jobs/*/config.xml
jobs/**/modules**/config.xml

But everything is ignored by Git. What am I doing wrong?

New Version regarding this answer- works almost fine:

#Ignore everything
*
#Don't ignore directories
!*/
#Don't ignore these files
!/.gitignore
!jobs/*/config.xml
!jobs/**/modules**/config.xml

But .gitignore files in subfolders aren't ignored. I want to except only the root .gitignore.

Community
  • 1
  • 1
BlackEye
  • 775
  • 11
  • 25
  • 1
    possible duplicate of [Whitelisting and subdirectories in Git](http://stackoverflow.com/questions/9162919/whitelisting-and-subdirectories-in-git) – nwinkler Feb 27 '15 at 10:27
  • 1
    Check out these answers: http://stackoverflow.com/a/9227991/1228454 and http://stackoverflow.com/a/8025106/1228454 – nwinkler Feb 27 '15 at 10:27
  • I think that * should be removed – Mihai Feb 27 '15 at 10:31
  • I read several .gitignore posts on stackoverflow but... the inapplicable ones. Apologize my double post. – BlackEye Feb 27 '15 at 13:39

1 Answers1

2

Last year, I contributed a .gitignore to GitHub gitignore project. It covers tracking all of your Jenkins configs using git.

https://github.com/github/gitignore/pull/1763

Sam Gleske
  • 950
  • 7
  • 19