- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What are the commonly used methods to auto-generate the .gitignore file?
The .gitignore file is a text file that tells Git which files or folders should be ignored while committing changes to the repository. This file lists the project files that we do not want Git to track for us.
Following are the two commonly used methods to auto−generate the .gitignore file −
Using the Github Site
The GitHub Site provides a collection of useful .gitignore templates for different technologies. The below screenshot shows a list of .gitignore templates provided by the site.
Let us say you are working on a Java project and would want to add a .gitignore file. All you have to do is −
Step 1 − Create an empty text file .gitignore and place it at the root of the project folder
Step 2 − Copy the contents of the .gitignore template for Java (that is shown below) into the file you have created.
Step 3 − Stage and commit the .gitignore file
Using Gitignore.io
Another recommended approach for creating .gitignore files is using the Gitignore.io tool.
As shown in the above screenshot, we can create a .gitignore file based an Operating System, IDE or Programming Language. Perform the following steps:
Enter the desired OS, IDE or Programming language and click on Create button. The tool will auto−generate the .gitignore file and render it in the browser. The following screenshot shows a .gitignore file created by the tool for a Golang project.
Create an empty text file in the project repository by the name .gitignore and copy the content generated by the tool
Index and commit the .gitignore file.
- Related Articles
- What are some of the commonly used methods of the array class in C#?
- What is the purpose of the .gitignore file?
- What are the gauges commonly used in production work?
- What are the most commonly used Idioms in English?
- What are some commonly used skin care tools?
- How to auto-generate a step definition to a feature file in Cucumber?
- What are the methods used to provide effects in jQuery?
- What are some rhetorical devices commonly used in English Literature?
- What are plastics? Name any five commonly used articles made of plastics.
- Which is the most commonly used strong acid?
- Which is the most commonly used strong base?
- What are the various fuels which are used to generate electricity in a thermal power plant?
- Technologies Commonly Used by Startups
- What are the indicators? Name some commonly known indicators.
- What are the types of system calls used in file management?
