Git. gitignore file compilation, git. gitignore

Source: Internet
Author: User

Git. gitignore file compilation, git. gitignore

. Gitignore exists in order to let git ignore the management of some files. Some files are generated according to the user's computer environment, which has no effect on the code, the update or synchronization may even fail. therefore, we need. gitignore File
There are three main ways to create it:

  • Method 1]
    Create a directory named. gitignore file (because it starts with a dot and has no file name, it cannot be directly created in the windows directory. You must right-click Git Bash to create a file in linux. gitignore file ). As shown in.
    The. gitignore file is valid for its directory and all subdirectories in the directory. By adding the. gitignore file to the repository, other developers update the file to the local repository to share the same set of ignore rules.
  • Method 2]
    Ignore the file by configuring the. git/info/exclude file. This method is globally effective for the repository and can only be used for the local repository. Others cannot share the ignore rules in this way unless others modify the file in the local repository.

  • Method 3]
    Use the core. Excludesfile option of the. git/config configuration file to specify a file that ignores the rule (full path), as shown in. The ignore rules are in the file e:/gitignore.txt (of course, the file name can be arbitrary ).
    The scope of this method is also global.

  • [Other methods]
    Currently, github, open-source China, and other libraries provide templates for developers to simplify our work. We only need to learn how to modify them.
Syntax notes
*. [Oa] # ignore *. B and *. B files, except my. B *. [bB]! My. B # ignore the dbg file and dbg directory dbg # ignore the dbg directory only, do not ignore the dbg file dbg/# Only ignore the dbg file, do not ignore the dbg directory dbg! Dbg/# Only the dbg files and directories under the current directory are ignored. The dbg of the subdirectory is not in the ignore range./dbg

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.