Skip to content

Instantly share code, notes, and snippets.

@JustinMcNamara74
Last active October 18, 2017 02:11
Show Gist options
  • Save JustinMcNamara74/a2f9a25e155943a9f796d477b8ebd912 to your computer and use it in GitHub Desktop.
Save JustinMcNamara74/a2f9a25e155943a9f796d477b8ebd912 to your computer and use it in GitHub Desktop.
Undo, fix, and redo a commit

git commit -m "Something terribly misguided"

Dammit, I forgot a [puts, console.log, etc..]

😟

Undo commit
  • git reset HEAD~

<< edit files as necessary >>

Add new changes
  • git add ...
Commit with original commit message
  • git commit -c ORIG_HEAD
Commit and append to original message
  • git commit --amend

😌

Credit to Mark Amery's post

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