Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add previously ignored directory to Git repository

Tags:

git

linux

My .gitignore file looks like:

html/ cache/ resources/ # Temp files often created by editors *.~ 

I know wish to start tracking a specific directory in html, so I add `!html/support/

html/ cache/ resources/ # Temp files often created by editors *.~ # Track support !html/support/ 

After doing so, however, Git still doesn't seem to track html/support/ and all its children.

How do I add a previously ignored directory to Git repository?

like image 437
user1032531 Avatar asked Apr 25 '14 14:04

user1032531


People also ask

How do I add ignored files to source control?

Open Visual Studio and the solution needing an ignore file. From the top menu select Git > Settings. The above will open Visual Studio's Options with Source Control > Git Global Settings selected. From the list on the left select Git Repository Settings and then click the Add button for Ignore file.

How do I add a folder to a git ignore list?

Repository exclude - For local files that do not need to be shared, you just add the file pattern or directory to the file . git/info/exclude . Theses rules are not committed, so they are not seen by other users. More information is here.


1 Answers

Not ignoring doesn't mean tracking.

Just use

git add html/support/ 

at the root of your git repository.

If the file is still ignored, though, you can use git add -f to force adding it (this will not modify the .gitignore file, just allow one little exception) :

git add -f html/support/ 
like image 168
blue112 Avatar answered Sep 28 '22 11:09

blue112