Git: First of all, this is exclusive setting (.gitignore file)

Other language site
ja ja
Google Translate
  • -

    シェア
  • ---

    LINEで送る
  • -

    はてなブックマーク
    ブックマーク
  • -

    pocket
  • -

    rss
Git Logo

This is how to specify ".gitignore" file to exclude log files, cache files, etc. which do not need to be registered in Git.

Actually there are various designation methods, but for now, you should remember this only.

Description method

ObjectDescription method
Exclude any file type (extension) *.log
Directories in all hierarchical directoriesdir_name

Pattern match

Patternmeaning
*0 or more character strings (other than /)
**0 or more files, directories (/ including)

For all hierarchical directories, we only list those that are excluded collectively. Let's just remember this for the time being.

Since it becomes detailed setting, it should be described as necessary.

How to use the pattern (**) is like this.

Suppose the directory structure is as follows.

dir1
  |- dir2
  |    |- dir5
  |         |- dir8
  |
  |- dir3
  |    |- dir6
  |         |- dir8
  |
  |- dir4
  |    |- dir7
  |         |- dir8

Specifying "**/dir5" results in the same result as "dir5". Use this directory if you have a directory with the same name and want to exclude only a part of it.

 

"**/dir2/**/dir8"

If specified like this, only dir8 under dir2 will be excluded. You can also exclude specific files by adding a file name pattern to the back.

SNS also distributes articles.
Leave a Reply

*

If you like this article, share it!