git-step-by-step
  • Introduction
  • Git Remote
  • Branch
  • Checkout & Reset
  • SSH Key
  • Branch
  • Diff & Merge
  • Commit
  • Log
  • Rebase
  • Fetch
  • Reflog
  • Tag
  • Stash
  • Configure Sublime for Linux
Powered by GitBook
On this page
  • Revert Commit
  • Alter commit history

Was this helpful?

Commit

Revert Commit

git log ( get hash few characters )
git revert <git hash (few char)>
git revert HEAD ( revert to last commit )

Alter commit history

Warning! - never want to do when changes pushed and used by other devs

// add new changes to recent commit without modifying commit message
git commit --amend --no-edit

// add new changes to recent commit with new commit message 
// ( recent commit message would be lost )
git commit --amend
PreviousDiff & MergeNextLog

Last updated 4 years ago

Was this helpful?