About the creation and use of gitignore files

Source: Internet
Author: User

  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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.