After reading proper section of GitHub Help I got completely lost. It says:
This file can be committed into the repository, thus sharing the rule list with any other users that clone the repository.
Up until now, people I've been talking to about Git were telling me that ".gitingore
file must be committed or else its rules won't work!"
Every Git begginer's question: "Why .gitignore
rules are not applied?" Could be answered with a simple: "Did you commit it?".
And now, here comes the GitHub Help saying, that this file can be commited, but it isn't necessary
gitignore file must be edited and committed by hand when you have new files that you wish to ignore. . gitignore files contain patterns that are matched against file names in your repository to determine whether or not they should be ignored.
gitignore file. If a file is added, committed and another commit with the . gitignore is created, the file will still be part of the repository and therefore cloned.
A . gitignore file is a plain text file where each line contains a pattern for files/directories to ignore. Generally, this is placed in the root folder of the repository, and that's what I recommend. However, you can put it in any folder in the repository and you can also have multiple .
A . gitignore file lists all of the files that are local to a project that Git should not push to GitHub. A . gitignore always goes in the top level of the project directory, which is also called the project's 'root'.
Yes, you can track the .gitignore
file, but you do not have to.
The main reason of having this file into repository is to have everyone working on the project, ignoring same files and folders.
Also see this: Should you commit .gitignore into the Git repos?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With