Fix untracked files for .gitignore

Fix untracked files for .gitignore

When you use git to store your codebase, the .gitignore file is really important. It can help you to untrack unrelated file, like some medium compiled and auto-generated files.

Basically, when you initail the git repository, the .gitignore will automatically created. You can add pattern to ignore files like below.

1
2
3
.DS_Store
*.component.js
*.component.js.map

But sometimes, those junk files will be created during your development and will be tracked as well (Always happen when you not add the pattern to .gitignore during initail stage). So we need to fix problem and untrack those files.

1
2
3
>git rm -r --cached . // Clean all tracked files
>git add . // Track all files except .gitignore patterns
>git commit -m "fixed untracked files" // Commit new tracked files