0
0

【備忘録】.gitignoreファイルについての説明や書き方を簡単にまとめる

Last updated at Posted at 2023-12-31

あれ、どうやって書くんだっけ。とふと思ったので、備忘録がてらまとめました。

.gitignore について

Git で管理されないファイルの事を言う。
ignore とは、「無視する、黙殺する、聞きながす、気付かないふりをする」などの意味がある。
よって、管理したくないファイルなどは、.gitignore というテキストファイルを使うのが良い。

書き方

sample ディレクトリに .gitignore が置かれているとしたケース
sample
 -- test_01.txt
 -- test_02.txt
 -- test_03.txt

  • ファイル名を直接指定する
test_01.txt
  • ディレクトリの指定(以降にあるファイルやフォルダも全て対象となる)
sample/
  • 例外を使って、test_02.txt だけは除外したい場合
!/sample/test_02.txt
  • 拡張子を指定したい場合
*.png
  • コメント
# 「#」でOK

以上。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0