14
13

More than 5 years have passed since last update.

.gitconfigファイルを直接いじってみる(設定関係メモ)

Last updated at Posted at 2016-05-02

.gitconfigをいじる前に

設定の確認方法

git config --list

gitに設定を追加する

※例として [alias]にco = checkoutを追加する場合
マシン全体に設定を追加する場合

git config --system alias.co checkout

リポジトリに設定を追加する場合

git config --global alias.co checkout

いざ.gitconfigをいじってみる

ひとまずホームディレクトリに移動して、.gitconfigを開いてみる
もしくは、下記コマンドを実施する

git config -e

開いてみると下記のような記述になっていると思われる(多分、人によって違うかも)

.gitconfig
[user]
  name = hoge
  email = hoge@exsample.com

colorとaliasとかいろいろ追加してみる。

.gitconfig
[user]
  name = hoge
  email = hoge@exsample.com
[color]
  ui = auto
[alias]
  co = checkout
  ci = commit
  st = status
  bra = branch
  gr = log --all --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
[gui]
    encoding = utf-8 # 文字コード設定
[receive]
    denyNonFastforwards = false # 強制pushを許可
[core]
    quotepath = false # 日本語コミットの文字コード化を防ぐ

他に設定できる項目は
- editor
- pager
- push
などがある。

14
13
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
14
13