git checkout
Reverts all changes (from the last commit)
git checkout -- .
Reverts
some.txt
file changes from the last commit (to discard changes in working directory)
git checkout -- some.txt
HEAD will be detached and pointed towards the commit (to go back to master
git checkout master
should be run)
git checkout b4ba3088679ff70b45df2aefc7c0a13d41a2bd76
Reverts all changes (from the specified commit)
git checkout b4ba3088679ff70b45df2aefc7c0a13d41a2bd76 .
Reverts
some.txt
file changes (from the specified commit)
git checkout b4ba3088679ff70b45df2aefc7c0a13d41a2bd76 some.txt
To switch to an existing branch
git checkout another_branch
To switch to a new branch
git checkout -b new_branch
by Valeri Tandilashvili
4 years ago
Git
1
Pro tip: use ```triple backticks around text``` to write in code fences