0
0

More than 1 year has passed since last update.

【Git】最初のコミットを変更する方法

Posted at

修正方法

以下のコマンドを実行します。

ターミナル
$ git rebase -i --root

するとGitで設定しているエディタが開きます。

pick f2a0ijl 最初のコミット
pick 4d506gf 2回目のコミット
pick 23456a5 3回目のコミット

最初のコミットのpickの箇所を編集します。

r f2a0ijl 最初のコミット
pick 4d506gf 2回目のコミット
pick 23456a5 3回目のコミット

すると以下のようにエディタに表示されます。

最初のコミット

# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.

コミットメッセージを変更して保存し、エディタを閉じます。

initial commit

# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.

コミットメッセージが変更されたことを確認してpushします。

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