Values in .gitignore_global ignored after changed

Josh B December 18, 2014

I accidentally added a common directory to .gitignore_global that I actually need to be able to commit. When I removed it from .gitignore_global I still can't get it to show up so I can commit it to my repositories.

This is affecting several repositories that this same dir is under.

I tried restarting SourceTree after making the change and saving the file, but no luck.

The dir is not ignored in any other .gitignore files and I double checked to be sure.

Mac OS 10.9

3 answers

1 accepted

1 vote
Answer accepted
Josh B December 19, 2014
0 votes
Seth
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 19, 2014

Maybe git itself has the global gitignore cached somewhere. Did you try rebooting?

0 votes
Robert Glover December 19, 2014

Git will not let you go back and change what happened in the past.  Now that you have modified .gitignore to remove a file from being listed there,  that change only applies to the future, not to the past.  If the file you are concerned about is named foo.txt,  than you need to to "git add foo.txt" and then git commit -m 'foo.txt no longer part of .gitignore. Will be tracked from now on'.

    And it goes without saying, that if the file is not physically in your working directly, then you need to put it there yourself manually, so that you can do that "git add foo.txt" in the paragraph above.

Josh B December 19, 2014

I tried doing "git add storage -f" for the "storage" directory which is what was ignored. This caused all .gitignore files in all the sub-directories to be ignored, which is not what I want since some files shouldn't be added. If I just do "git add storage" I get the error "The following paths are ignored by one of your .gitignore files: app/storage" I've checked all my .gitignore files all the way up (there are only two) and neither has that entry for storage.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events