Use. Gitignore to ignore certain files "go"

Source: Internet
Author: User

Transferred from: http://www.cnblogs.com/shangdawei/archive/2012/09/08/2676493.html
http://blog.csdn.net/richardysteven/article/details/6069418
Each row in the file represents a regular expression of the file that needs to be ignored.
Vim. Gitignore

The current directory situation
$ls-altotal 24drwxr-xr-x 4 root root 4096 2010-12-11 12:44. drwx-------root root 4096 2010-12-11 12:44. Drwxr-xr-x 8 root root 4096 2010-12-11 12:44. git-rw-r--r-- 1 root root the 2010-12-11 12:44. gitignoredrwxr-x R-x 3 root root 4096 2010-08-19 20:01. metadata-rw-r--r-- 1 root root , 2010-12-11 12:41 test.txt If the file is not added, G It status will report that these files are not track.
$git status# on branch master# untracked files:# (use "git add <file> ..." to include in what would be committed) # # . metadata/# Gitignore When you add the file, you can see that the workspace is clean.
$[[Email Protected]~/workspace]
$git status# on Branch masternothing to commit (working directory clean) this. Gitignore is very simple, there is a. Metadata in the current directory, this is what we do not need, so we write to the file.
In addition, if you do not add. Gitignore this line, Git will also add. gitignore to version control.

Brief introduction
Ignores files that are implicitly considered the current directory .gitignore .
You can also excludesfile specify a global ignore file by modifying the global configuration Git-config.
git config--global core.excludesfile ~/.gitignore
Get .gitignore into the habit of setting it up right from the start,
The syntax of the. Gitignore
#As comment lines, blank lines do not match any files, and these two characteristics make the .gitignore file more readable.
By ! taking the reverse.
The / characters at the end of the diagonal bar are treated as folders, and all files under the folder are ignored.
In addition to the above three cases, the standard glob pattern matching is used at other times.


sometimes. Gitignore seems to be ineffective, but the real problem is that ignore does not handle the files that have been add.

So no matter how you modify the path, it is not possible to remove the displayed file.

Http://stackoverflow.com/questions/2545602/git-ignore-sub-folders

Permalink http://www.shrekwang.com/bbs/a/436005

Use. Gitignore to ignore some file "go"

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.