Last active
February 4, 2018 04:03
-
-
Save jkereako/39a0f97eb6268ac88807 to your computer and use it in GitHub Desktop.
Restore files in Git
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# `git clean` removes all untracked files and `git checkout` clears all unstaged changes. | |
# see: http://stackoverflow.com/questions/52704/how-do-you-discard-unstaged-changes-in-git#12184274 | |
git clean -df | |
git checkout -- . | |
# @see: http://stackoverflow.com/questions/953481/restore-a-deleted-file-in-a-git-repo#4332209 | |
# Restore all deleted files in Git | |
git ls-files -d | xargs git checkout -- | |
# Revert all local changes to the last commit | |
git ls-files -m | xargs git checkout -- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment