Well, I’ll try to describe how I know and use, because macros information, you find several around, after all GIT is extremely used.
- revert - It does the informed commit rollback, basically a Ctrl+z, imagines that you did the X commit and realizes that you broke the
application, in the greatest urgency you need to return as was before,
you revert the X commit, but the times I used it, it
this explicitly, generating a new commit for this revert, so
it will be in your history.
- reset - His idea is exactly this, return to a previous state, but other than revert, it does not generate commit, it undoes
all the same, I never used it sending to the server (I don’t know if it scrolls), but the times that
committed in master by mistake, I reset the last commit
valid from the master, with this he restored the master and simply
deleted my incorrect commits
- checkout - This guy goes to a branch, tag, commit etc... He can completely change the state of your fonts, imagine you
is already in commit 100, but someone reports a problem that occurred in
commit 50, you can get back to that commit with the checkout.
I use it mainly to change branch, between master,
innovation (CR) and current version of the application. I also use git checkout to undo something I haven’t committed yet, like git checkout app.js, it rules out everything I’ve done and haven’t committed or git add yet.
I recommend you create a repository in some git free and play with these commands.
Besides the question that hkotsubo quoted, there’s this one that’s pretty cool:
How do I undo the last commit in git?
About the reset, already have that question
– hkotsubo