LoginSignup
26
26

More than 5 years have passed since last update.

特定のGitリポジトリだけAuthorを変更する

Posted at

皆さんGitを使う際には$HOME/.gitconfig辺りにuser.nameuser.emailを設定しているかと思います。

$HOME/.gitconfig
[user]
  name = sasaplus1
  email = sasaplus1@gmail.com

が、たまに特定のリポジトリでは別名でコミットしたい、ということがあるかと思います。そういう場合は以下のようにすると良いかと。

Terminal
$ cd 特定のリポジトリ
$ git config user.name hogehoge
$ git config user.email hogehoge@example.com

とすると、リポジトリ内にある.git/configに設定が追加されるため、このリポジトリ内でコミットした場合は

$ git log
commit xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Author: hogehoge <hogehoge@example.com>
...

のようになります。という同僚向けの投稿でした。

ちなみにコマンドを実行するのが面倒な場合は、テキストエディタで直接.git/configを編集すると良いかと思います。$HOME/.gitconfigに書いているような書式で書けば良いだけです。

26
26
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
26
26