1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【Git】2つ以上前(過去)のコミットを修正(超要約)

Last updated at Posted at 2025-02-22

コミットをできる限り綺麗に残したい勢の皆様、本当にお疲れ様です。
長い説明はしません。コマンドと一口メモだけを残します。


  1. git rebase -i 6a8a3d8c(修正対象の1つ前のコミットIDを指定)
  2. (rebase選択画面) 修正したいコミットIDへ移動し pick 文字列を edit へ変更し保存
  3. git status (状況確認:Last command done に対象コミット情報あり確認)
  4. 目的のファイルを開き、修正を行う
  5. git status(状況確認:修正したファイルのみが modified 状態確認)
  6. git add 修正したファイル
  7. git commit --amend(コミットメッセージ変更しても、しなくてもOK)
  8. git rebase --continue(Successfully 表示されるはず)
  9. git push --force-with-lease origin your_branch

GitHubで確認し終了.

1
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
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?