LoginSignup
0
0

More than 3 years have passed since last update.

今までのコミット全てを1つにまとめる方法

Posted at

全てのコミットを1つにまとめる方法

 gitがよく分からなかった頃のcommitを整理したのでそのメモです。

1. git rebaseコマンド

git rebase -i --root

2. 編集

vimが立ち上がる。
iを押してInsertモードに変え、最初のコミット以外をf(コミットメッセージを残さない)またはs(コミットメッセージを残す)に変更する。
変更後はesc→:wq(上書き保存して閉じる)

 pick 87c9788 commitC
 f 981c917 commitB
 f 05d649c commitA

3. 自己責任でpushする

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