Skip to content

Instantly share code, notes, and snippets.

@hoox
Last active August 29, 2015 14:26
Show Gist options
  • Save hoox/cef6e0a33bbdfd4f4436 to your computer and use it in GitHub Desktop.
Save hoox/cef6e0a33bbdfd4f4436 to your computer and use it in GitHub Desktop.
Git Rewrite History

Rewriting History

Run the command:

git rebase -i @~5

This displays the last 5 commits.

Then:

  • Find the commit you want to edit
  • Replace pick with e
  • Save

Edit, save, and add the require files, and then run:

git commit --amend

After saving, run:

git rebase --continue

Reseting back to commits within 90 days

git reset @~5
git reflog
git reset <commit>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment