What is .gitignore and how do i generate or write one?

  • gitignore file is used to specify files which should be untracked by Git.
  • Each line of the file represents a filename, directory, or pattern.
  • When git looks for changes in your working directory, it will automatically ignore any file that matches an entry in your .gitignore file.
  • For example, when working for a java spring boot project, tracking the class files in target folder or files related to ide does not make any sense.
  • Writing one for the projects that i worked was always an evolving task. I will do a git status check the list of files ready to be committed and then update my .gitignore file with the extension of files that i don’t want to track .
  • Another approach that i followed was copying .gitignore from existing projects .
  • gitignore.io is an open source project which solves this problem very efficiently.
  • Goal of this project is to generate a valid .gitignore file for you
  • All you need to do is use the autocomplete box provided to describe the type of project you’re working on
  • Click on Create button, and that will take you to a page that displays nothing but the raw text which you’ll need to add to your project’s .gitignore

Thanks !!!

Leave a Reply