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.
  • 21,107
  • 41
  • 146
  • 258
  • 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

1

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
  • 1,957
  • 2
  • 10
  • 23
0

You need to do like this:

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