One of the topics that software development beginners should know is the concept of .gitignore. Every software developer has to use git infrastructure at the end of the day. For this reason, we need to learn the concept of .gitignore.
What is .gitignore File? Why do we use it?
It is a settings file that prevents files and folders that we do not want to be in the Git repo from being in the “Repository”.
For example if you are android developer .apk, .gradle, .idea etc. It is not necessary to upload a file with the extension extension to the git repository. Because this project will be different on the computers of the software developers in the group you are working with. For this reason, we need to use the .gitignore structure.
How do we use the .gitignore File?
First of all, you need to create a special repo file for the programming language you are dealing with. Let’s create a file with the (.gitignore) extension. It is enough to put this created file in the main directory of our project.
Structures used in .gitignore
To write a #comment line, we have to write a (#) at the beginning. # To skip a specific file (filename) gradle # To skip a directory (folder/) thousand/ # To skip files with a specific extension (.extension) *.class # Ignore log files but exclude error.log files. *.log !errors.log
Since we can create our own .gitignore file, we can reach a comprehensive .gitignore file with a short search. For Android copy all content from this link and save it in your own file.
.gitignore file is available not only for android developers but also for many different software projects. .gitignore Files