Skip to content

Instantly share code, notes, and snippets.

@taea
Last active August 25, 2021 15:33
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save taea/4762656 to your computer and use it in GitHub Desktop.
Save taea/4762656 to your computer and use it in GitHub Desktop.
n個前のcommitやり直し(git rebase -i)

例えば3つ前のcommitをやり直したいとき

git rebase -i HEAD~~~

または

git rebase -i HEAD~3

(~~~の数だけHEADから遡れる)

edit f7f3f6d changed my name a bit
pick 310154e updated README formatting and added blame
pick a5f4a0d added cat-file

編集したいcommitの頭をeditに変える

:w

保存→とじる

git commit --amend

なおす

git rebase --continue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment