davegomez
11/16/2018 - 12:45 PM

Git - Amend Specific Commit

Modify any commit in project's git history keeping the current history structure.

# Use the commit hash (first eight characters) 
git rebase --interactive '<commit-hash>^'

# In the default editor, modify pick to edit in the line whose commit you want to modify
# Make your changes and then commit them with the same message you had before
git commit --all --amend --no-edit

# Finish the rebasing process
git rebase --continue