-1

Here is my root which git is installed there:

htdocs/
    .git
    xampp
    test
    myweb
    myweb_dependencies
    onOtherProject
    php_info.php
    .gitignore

Also here is the content of .gitignore:

# Ignore everything
*

# But not these files
!myweb
!myweb_dependencies

What I want to do is ignoring everything except these two directories: myweb and myweb_dependencies.

The problem is: apparently the content of .gitignore is wrong, because it doesn't track changes into myweb directory. How can I fix it?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Martin AJ
  • 6,261
  • 8
  • 53
  • 111
  • 2
    Possible duplicate of [How do I tell Git to ignore everything except a subdirectory?](https://stackoverflow.com/questions/1248570/how-do-i-tell-git-to-ignore-everything-except-a-subdirectory) – Bless Feb 27 '18 at 16:44
  • @Martin AJ can you try appending a `/` to your "But not these files"? – Tyler Feb 27 '18 at 16:46

1 Answers1

1

It should be like this:

# Ignore everything
/*
/*/

# But not these files
!/myweb/
!/myweb_dependencies/
Martin AJ
  • 6,261
  • 8
  • 53
  • 111