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

Source: Internet
Author: User

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 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
! 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

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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: and provide relevant evidence. A staff member will contact you within 5 working days.