Create. gitignore files under Windows (some files are ignored when Git commits)

Source: Internet
Author: User
Tags zip

I believe that when you submit a file using Eclipse's Git plug-in, There is a problem with the possibility of accidentally submitting unnecessary documents (such as the. project,.classpath file or the. Settings folder and the files below), and there is no way to ignore the files.
The simple way to do this is to create a new. gitignore file in the project directory, and then declare the folder or file you want to ignore in it. Troublesome place to come, because the file is the point at the beginning, no file name, no way to create directly under Windows. We can create a new. gitignore file through Linux by installing Git and then right-clicking on "Git Bash here" in the project root directory.

The detailed steps are as follows: Install git and download the latest git for the Windows platform on Git's website first. When the download is complete, click Install, in the "select
Components "Step, remember to select Simple context menu (pictured below). Other by default, direct click Next to install complete.
Right-click on "Git Bash here" to enter the command line on the project root directory. Enter the vim. Gitignore command to edit the content
. Project
. classpath
. settings
. gitignore
Press Wq to save the exit and the. gitignore file will be generated. When you commit with git at this point, you will not see any of the above excluded files. There are two modes of gitignore file filtering, open mode and conservative mode Open mode is responsible for setting and filtering which files and folders
settings/means filtering this folder
*.zip Filter zip suffix file
Test.java Filter The file conservative mode is responsible for setting which files are not filtered, that is, which files to be tracked.
!src/Tracking This folder
!*.java Trace Java source files
! Test.java Trace the file

Tips: Open mode and conservative mode can be used in combination with the method of configuration. There are a lot of folders and files under one folder, and I just want to keep track of one of the files. You can use open mode to set the entire directory to not track, and then use conservative mode to set the file in this folder to be tracked to be tracked, you can only track a file.

Related Article

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.