Last active
October 28, 2015 14:59
-
-
Save guillermoroblesjr/9b5892d8d8d35abb08c5 to your computer and use it in GitHub Desktop.
Git checkout/revert to an older hash on a new branch
This file contains hidden or 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
| # directory goes back to the hash, ALL changes AFTER hash are discarded. | |
| # you can always merge in a different branch to update later changes. | |
| git checkout -b <temp-branch-name> <myHashGoesHere> | |
| # OR | |
| # create a new branch | |
| git checkout -b <temp-branch-name> | |
| # reverts all files that were originally part of this hash back to their | |
| # state at the time of the hash. | |
| # any files that were added after this hash are not unaffected and stay | |
| # the same. | |
| git checkout <hash> . |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment