man gitignore * nix PATTERN FORMAT, :
- "!" ; , . , . Git , , , . ( "\" ) "!" , "!" , , "! important!.txt".
Pay attention to the selected area. In the case you have presented, where you want to unlock files that fall under a subdirectory of a directory that you ignore, the un-ignore operator !will not function. Instead, you should be more specific with the ignore pattern.
Try this for size:
/assets/img/*/*
!/assets/img/KEEP_SOMETHING_IN_THIS_FOLDER/KEEP_THIS_FILE*.jpg
source
share