LoginSignup
5
4

More than 5 years have passed since last update.

[初期設定]初学者が最初に「.gitignore」を設定する方法

Last updated at Posted at 2018-06-22

目次

  1. 「.gitignore」とは?
  2. 初期設定の方法

1. 「.git ignore」とは?

Gitで開発を行っていると、Gitの管理下に置きたくないファイルが出てくることがあります。
そういった場合に、意図的に追跡対象から外したい(無視したい)ファイルを設定するためのファイルです。

  • metaデータ(開発環境で自動作成されるデータ)
  • コンパイル、ビルドした時に作成されるデータや実行形式ファイル
  • その端末固有の設定情報が記載された環境変数などのファイル
  • セキュリティ上、共有したくないファイル

そこでGitでは「git ignore」という機能を利用して、Gitの管理外に置くファイルを設定することができます。


2. 初期設定の方法

以下の便利なツールが2つあります。
- gitignore.io
- gibo

  • 今回は gitignore.io を使った設定方法を紹介します。

https://gyazo.com/118b494c3065e2e3ad29107f977ee3c1

表示された設定記述を貼るだけ!

2018-06-22 11.19.59.png

.gitignore
### Ruby ###
*.gem
*.rbc
/.config
/coverage/
/InstalledFiles
/pkg/
/spec/reports/
/spec/examples.txt
/test/tmp/
/test/version_tmp/
/tmp/

# Used by dotenv library to load environment variables.
# .env

## Specific to RubyMotion:
.dat*
.repl_history
build/
*.bridgesupport
build-iPhoneOS/
build-iPhoneSimulator/

## Specific to RubyMotion (use of CocoaPods):
#
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
#
# vendor/Pods/

## Documentation cache and generated files:
/.yardoc/
/_yardoc/
/doc/
/rdoc/

## Environment normalization:
/.bundle/
/vendor/bundle
/lib/bundler/man/

# for a library or gem, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# Gemfile.lock
# .ruby-version
# .ruby-gemset

# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
.rvmrc

まとめ

とりあえず、gitignore.io 便利🤗

5
4
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
5
4