0
0

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で直近でない過去Commitをいじる

0
Last updated at Posted at 2026-05-10

最近はClaude Codeの利用が増えましたが、その関係でCommitも増えました。
また、予期しないBugも増えてきてしまっているので、よく使うGitコマンドを改めて書き留めておきます。

# 最新Commitを取り消してUnstage状態にする。
$ git reset --soft HEAD~1

# Degradationが起こったCommitに対して修正を直接する。
$ git rebase -i <target commit hash>^ --rebase-merges
# target commit hashのところをpick --> editに変更し、必要な修正を加えた後、以下を実行。
$ git add <files> && git commit && git rebase --continue
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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?