Send by LINE
B! Bookmarks in Hate-bu
Bookmarks in Pocket
RSS feeds

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

Other language site
No available translations found
Google Translate
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

Object Description method
Exclude any file type (extension)  *.log
Directories in all hierarchical directories dir_name

Pattern match

Pattern meaning
* 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.

Leave a Reply

*