17
16

More than 5 years have passed since last update.

間違って個人用の名前でコミットしたけど会社用のにしたい

Last updated at Posted at 2014-12-03

個人のpcで仕事してたら、間違って自分のuser.nameとuser.emailでコミットしてしまった。

修正手順

何番目からやっちまったのか確認

$ git log

6番目からやっちまってたら

$ git rebase -i HEAD~6 -x "git commit --amend --reuse-message=HEAD --reset-author"

これで現設定のuser情報になる。

あとはpush -fして終わり。もちろんdevelopやmasterでやったらだめ。

リポジトリごとにuser情報分ける

リポジトリごとにuser情報分けるときは、

~/.gitconfig.my
[user]
  name = fuga
  email = foo@fuga.com

~/.gitconfig.work
...

みたいなのを用意しておいて

$ g config -e

[include]
  path = ~/.gitconfig.work

としてuser情報を上書きしてる。

17
16
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
17
16