間違いだらけの備忘録

このページの内容は無保証でありこのページの内容によって直接、または間接に損害を受けられたとしても私は責任を取りません。

pushした履歴の修正

直前のcommitを修正

$ git commit --amend

pushしてしまったcommitを修正

$ git push
 ! [rejected]        master -> master (non-fast-forward)
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again.  See the
'Note about fast-forwards' section of 'git push --help' for details.

$ git push origin +master
Counting objects: 5, done.
Delta compression using up to 4 threads.
 + 40933f6...91621ef master -> master (forced update)

参考
http://d.hatena.ne.jp/mrgoofy33/20100910/1284069468
http://pandazx.hatenablog.com/entry/2012/10/14/005716

作者とコミッターを修正
http://tobysoft.net/wiki/index.php?git%2F%A5%B3%A5%DF%A5%C3%A5%C8%A5%ED%A5%B0%A4%F2%BD%A4%C0%B5%A4%B9%A4%EB%CA%FD%CB%A1

コミット時に--amendと--authorを指定

git commit --amend -m "test test test" --author="my_new_name <new_name@example.com>"

めも

このページにはhatena以外のサービスからのコンテンツが埋め込まれています。 hatenaによりGoogle AdSense 広告が埋め込まれています。