When we use GitHub to submit local code, some library files and log files are not required to be submitted, and now we will use the. gitignore file.
This working environment is based on ubuntu14.04.
Create
First, the. gitignore file should be created under the root directory of your project, and you can use
Vim. Gitignore
or a
Gedit. Gitignore
For example, one of my. gitignore files is as follows:
12Dist3. tmp4bower_components5 Test
These files are both library files and auto-generated modules that are not required to be submitted. I'll tell you a deal about handling files that have been submitted unnecessarily.
How to handle files that have been submitted unnecessarily
Sometimes when we understand this gitignore, we find that we have submitted unnecessary documents, and we are a more perfect person, do not want to let those files exist in our library, how to do? Is there any way? There must be some way.
First, we create the. gitignore file at the end of the project with the file, and add the file that needs to be ignored, such as one of My. gitignore files above. Then enter the following command
Git rm-r--cached The file name to delete
and then
git push
In the end we'll go to our GitHub library and we'll find that what we just deleted has been successfully removed.
About the creation and use of gitignore files