Closed smiklin closed 5 years ago
git reset
undos the files you stage to commit, i.e. git add file_A.py
but cannot be used to reverse committed changes. Using git status
at various stages in the terminal helps illustrate what git reset
is doing. On the other hand, git revert
is for correcting faulty commits: https://git-scm.com/docs/git-revert
Thanks!
So, I'm a Contributor 3 and accidentally pushed straight into our master instead of creating a pull request. In the future, if something like this happens, what is the best way to 'undo' a commit?
I googled to find the
git revert <SHA>
but I'm not really sure how I'd use that? How is it different from a git reset? When is to use one vs another?