Sometimes your project that you are going to upload to GitHub contains some very important data that you donโt want the whole internet to see. Thus to tackle this problem it is very essential to maintain a .gitignore file that excludes the different files that you donโt want to be uploaded.
Some common examples of files that you donโt want to get uploaded to the git servers are:
- dependency caches, such as the contents of /node_modules or /packages.
- compiled code, such as .o , . pyc , etc
- build output directories, such as /bin, /out, or /target
- files generated at runtime, such as .log, .lock, or .tmp
- hidden system files, such as .DS_Store or Thumbs.db
- personal IDE config files, such as .idea/workspace.xml
Git sees every file in your working copy as one of the three things
- Tracked - a file which has been previously committed
- Untracked - a file which has not been committed before
- Ignored - a file which git was explicitly told to ignore
There is no code to toggle gitignore, it is a file that you have to create before committing and maintain it regularly. You have to put names of the files that you want to ignore.
A gitignore file specifies intentionally untracked files that git should ignore. Files already tracked by git are not affected.
Top comments (0)