Add previously ignore files to git

Lets assume we had a project that was ignoring the /proj/mymodule directory.

 

To add it to git for tracking. We need to make sure it is not a submodule. A submodule is another git project that is within our main project. If that is the case we need to delete the .git/ folder in /proj/mymodule.

Next we need to stop ignoring the file, ex, by removing it from our .gitignore file.

 

Clear the git index. (may not really be needed)

git rm --cached /myproj/mymodule

Forced add it to the respository

git add -f /myproj/mymodule

 

Keywords: 
add to git repository ignored file files folder unignore
Cookbook Category: 
Git

Add new comment