gitあれこれ

created at 2019-08-23 07:12+0900

gitignore設定

github/gitignore からお手本を拝借する。

OSと汎用的に使うテキストエディタ関係の定義はグローバル設定に入れる。

{
  echo "##### get from https://github.com/github/gitignore at $(date +'%Y-%m-%d %H:%M:%S'). start ######"
  echo "##### MacOS ################################################"
  curl -L https://github.com/github/gitignore/raw/master/Global/macOS.gitignore
  echo
  echo "##### Vim ##################################################"
  curl -L https://github.com/github/gitignore/raw/master/Global/Vim.gitignore
  echo
  echo "##### get from https://github.com/github/gitignore at $(date +'%Y-%m-%d %H:%M:%S'). End ######"
  echo
} > ~/.config/git/ignore

プロジェクトごとに使うIDEに合わせてローカルのexcludeへ入れる。

# なかったら作る
ls -la .git/info/exclude
mkdir -p .git/info

# Xcodeの場合
curl -L https://github.com/github/gitignore/raw/master/Global/Xcode.gitignore >> .git/info/exclude

# PyCharmの場合
curl -L https://github.com/github/gitignore/raw/master/Global/JetBrains.gitignore >> .git/info/exclude
echo "#### Python ####" >> .git/info/exclude
curl -L https://github.com/github/gitignore/raw/master/Python.gitignore >> .git/info/exclude

# Anddoid Studioの場合
curl -L https://github.com/github/gitignore/raw/master/Android.gitignore >> .git/info/exclude

# Eclipseの場合
curl -L https://github.com/github/gitignore/raw/master/Global/Eclipse.gitignore >> .git/info/exclude

# Unityの場合
curl -L https://github.com/github/gitignore/raw/master/Unity.gitignore >> .git/info/exclude

プロジェクト固有の無視設定は.gitignoreへ入れる

echo 'mypoem.txt' >> .gitignore

git-secrets を使う

See also git-secrets 導入

覚えられないgit コマンド

See also git コマンドメモ

参考サイト