Basically, I have the following folder structure:
repo
README.md
testing_folder
readingme.md
resources_folder
And in my .gitignore file
, I want to ignore all files except folders in current directory and this is what I have :
*
!.gitignore
!*/
When I do git status
, this is what I get:
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
modified: .gitignore
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: .gitignore
modified: README.md
Problem is: it doesn't show that the testing_folder
and resources_folder
are untracked
. And when I try to do git add testing/readingme.md
, I got the following error message:
The following paths are ignored by one of your .gitignore files:
testing/readingme.md
Use -f if you really want to add them.
fatal: no files added
I am starting to get really confused now because I have read so many other related posts. They seem to work but mine just doesn't work.
I tried including and excluding the !*/
statement in .gitignore file but still the folders are not shown as untracked
.