0

I have the followin .gitignore file.

plugins
code/golang/*
!code/golang/src/goclient

I expected that everything under code/golang/* would be ignored except !code/golang/src/goclient.

What am I doing wrong - do you know?

Chris G.
  • 23,930
  • 48
  • 177
  • 302
  • Possible duplicate of [.gitignore exclude folder but include specific subfolder](https://stackoverflow.com/questions/5533050/gitignore-exclude-folder-but-include-specific-subfolder) – phd Jun 18 '18 at 14:58

2 Answers2

2

Try specifying the exact subdirectory.

#exclude everything in golang     
code/golang/*      

#except the src subdirectory
!code/golang/src/* 

#exclude everything in source
code/golang/src/*

#except the goclient
!code/golang/src/goclient
Josh Adams
  • 2,113
  • 2
  • 13
  • 25
0

You need to do like this:

plugins
code/golang/*
!code/golang/src/
code/golang/src/*
!code/golang/src/goclient/
hatsagorts
  • 66
  • 1
  • 7