DEV Community

Discussion on: 5 Git Tricks Every Developer Should Know

Collapse
 
jnareb profile image
Jakub Narębski
  1. How do I undo/redo the most recent local commits in Git?

If you want to redo the most recent local commit, why not use git commit -a --amend instead the long sequence of commands described in the article, namely:

git reset HEAD~
git add .
git commit -m "some message"
Enter fullscreen mode Exit fullscreen mode

versus

git commit -a --amend -m "some message"
Enter fullscreen mode Exit fullscreen mode

Also, you should only rarely use git commit -m "some message" in real life; most often than not the commit message should be longer than just a single line.