2

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?

Bizhan
  • 16,157
  • 9
  • 63
  • 101
  • Basically, gitignore will not track the files you put in the gitignore, but if you are already tracking them, you need to untrack them to get it to work. Notice that you need to commit before executing these commands, as they will otherwise delete your existing changes. ```git rm -rf --cached . && git add .``` – Fredrik Schön Jan 04 '17 at 12:40
  • @Fredrik thanks I will try this and see if it helps in future syncs. – Bizhan Jan 04 '17 at 12:42
  • that's it. it was caching the file. ty – Bizhan Jan 04 '17 at 13:12

1 Answers1

1

Try Removing the file from git chached:

$ git rm --cached ProjectSettings/ProjectSettings.asset
Sajib Khan
  • 22,878
  • 9
  • 63
  • 73