LoginSignup
0
1

gitでコミッターを変更する手順

Posted at

本業と副業でgitアカウントを複数個持っていたりすると別の組織のアカウントでコミットしてしまうことがあると思います。そんな時に役立つコミッターを変更する手順です。

  1. ログの確認

    git log --oneline
    
  2. 変更したいコミットまでrebase

    git rebase -i #{変更したいコミットの1つ前のコミットID}
    
  3. コミットを編集モードに
    2を実行するとターミナル上にエディタが開くので変更するコミットの先頭のpickeditに変更します。変更できたら:wqでエディタを抜ける

  4. コミッターの情報を入れる

    git commit --amend --author="sample_name <sample_name@example.com>"
    

    リモートのgitアカウントのユーザー名とメールアドレスを指定します
    ユーザー名とメールアドレスは以下のコマンドで確認できます

    git config user.name
    git config user.email
    
  5. rebaseの続行

    git rebase --continue
    
  6. リモートへpush

    git push --f origin target_blanch
    
0
1
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
0
1