0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

[git] gitignore.io から .gitignore ファイルを npx コマンドで生成する方法

Posted at

動機

環境構築する際に gitignore.io からコマンドラインからファイルが取得できれば楽だと思い、やり方を探したところ公式ドキュメントにやり方が書いてありました。

そのまま紹介したいと思います。

環境

  • Node.js 環境導入済
$ node -v
v19.7.0
$ npm -v
9.6.1

コマンド実行

npx add-gitignore を実行するだけです。

$ npx add-gitignore
? What environments would your .gitignore to ignore?
❯◯ 1c
 ◯ 1c-bitrix
 ◯ a-frame
 ◯ actionscript
 ◯ ada
 ◯ adobe
 ◯ advancedinstaller
 ◯ adventuregamestudio
 ◯ agda
 ◯ al

コマンド実行後に、文字を入力すると検索ができるので、指定したい言語やフレームワークを十字キーでカーソルを合わせてスペースキーで選択ができます。

選択した状態で Enter キーを入力するとコマンドを実行した階層に .gitignore ファイルが生成されます。

余談

これをうまく組み込んで CI で自動更新できないかとも思ったのですが、.gitignore ファイルは自動更新するようなものではない気がするので、検討するのを辞めました。

以上です。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?