LoginSignup
7
6

More than 5 years have passed since last update.

よく使いはしないけれどまとめておきたかったGitの設定

Posted at

あまりよく使うものではないけれど,最近個人的にたまによく使うことが多い設定をまとめてみました.

user.nameuser.emailの設定

設定の確認

$ git config --global --list
user.name=shy_azusa
user.email=shy.azusa@gmail.com

設定方法

$ git config --global user.name 名前
$ git config --global user.email メールアドレス

入力例

$ git config --global user.name shy_azusa
$ git config --global user.email shy.azusa@gmail.com

remoteの設定

設定の確認

$ git remote -v
origin git@github.com:shyazusa/origin.git (fetch)
origin git@github.com:shyazusa/origin.git (push)
github git@github.com:shyazusa/github.git (fetch)
github git@github.com:shyazusa/github.git (push)

設定方法

追加

$ git remote add リモート名 リモートのURL

編集

$ git remote set-url リモート名 リモートのURL

削除

$ git remote rm リモート名

入力例

$ git remote add github git@github.com:shyazusa/add.git
$ git remote set-url github git@github.com:shyazusa/edit.git
$ git remote rm github

その他設定

設定方法

gitの補正をオンにする

$ git config --global help.autocorrect 待ち時間

変更のdiffを見ながらコミットメッセージを書く

$ git config --global commit.verbose trueかfalseでオンオフ

入力例

$ git config --global help.autocorrect -1
$ git config --global commit.verbose true
7
6
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
7
6