Skip to content

Instantly share code, notes, and snippets.

@sadmansh
Created September 27, 2020 07:07
Show Gist options
  • Save sadmansh/74b876f90c847b159cde65fbe1583f69 to your computer and use it in GitHub Desktop.
Save sadmansh/74b876f90c847b159cde65fbe1583f69 to your computer and use it in GitHub Desktop.
Modify a specific commit
  1. Get commit hash (eg. 8fd8s97fcd)
  2. $ git rebase --interactive '8fd8s97fcd^'
  3. In the editor, change 8fd8s97fcd from pick to edit and save, exit
  4. At this point, 8fd8s97fcd is your last commit
  5. Make changes
  6. $ git add
  7. $ git commit --all --amend --no-edit
  8. $ git rebase --continue

Credits: https://stackoverflow.com/a/1186549

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