Some time ago I set up my .gitignore
file to not track a folder my_folder
with:
my_folder/
Now I want to track only a given file inside said folder, named my_file.md
. After making .gitignore
look like this:
my_folder/
!my_folder/my_file.md
and checking:
git status
the file does not appear as a change to be committed.
What am I doing wrong?
Add
I tried changing my .gitignore
file to:
my_folder/*
!my_folder/my_file.md
as advised but the file is still not showing up as a change to commit after a git status
. Do I need to reset something?
Add 2
Attempting to add the file with git add my_folder/my_file.md
returns:
The following paths are ignored by one of your .gitignore files:
my_folder/my_file.md
Use -f if you really want to add them.
fatal: no files added
The command git check-ignore -v my_folder/my_file.md
gives:
.gitignore:1:my_folder/* my_folder/my_file.md