Skip to content

Latest commit

 

History

History
16 lines (12 loc) · 527 Bytes

Undoing.md

File metadata and controls

16 lines (12 loc) · 527 Bytes

Undoing Wrong Commits

Remember to Use Git Log Before Pushing

git log

You Can Fix a Commit Message With

git commit --amend -m "New Commit Message"

You can also add some files before, in case you forgot: git add <MissingFile>.

Undoing a Commit

git reset --soft HEAD^

This command will return a commit in your repository, but modified files will still be in your directory.

You can use git reset --hard HEAD^ if you want to Throw Away both the commit and files/modifications.