How to ignore one file in gitignore while unignoring its parent folder

Question

I want to ignore everything in my project except for

  1. .gitignore file
  2. Assets folder
  3. ProjectSettings folder

Additionally I want to ignore one file ProjectSettings/ProjectSettings.asset


I searched around and wrote this in my gitignore file:

# Ignore Everything
/*

# Except for these:
!/.gitignore
!/Assets
!/ProjectSettings

# Ignore just ProjectSettings
!/ProjectSettings/*
/ProjectSettings/ProjectSettings.asset

The problem is it is still including ProjectSettings/ProjectSettings.asset in my commits. How can I ignore this file while un-ignoring its parent folder?


Show source
| git   | unity3d   | gitignore   2017-01-04 12:01 1 Answers

Answers ( 1 )

  1. 2017-01-04 13:01

    Try Removing the file from git chached:

    $ git rm --cached ProjectSettings/ProjectSettings.asset
    
◀ Go back