I have a git repo, and a revision code I want it to get my local clone to. How can I bring it up to a specific revision and get rid of any changes I've made?
With the new git switch command, we can either: git switch -c <new-branch> <commit> to create a new branch named <new-branch> starting at <commit> git switch --detach <commit> to switch to a commit for inspection and discardable experiments.
Reverting To An Old Version of the RepositoryStart by navigating to the “History” tab. Right-click on the previous commit, and you'll see the option to revert this commit. If you click on Revert This Commit , two things will happen. The first is that the files in your repository will revert to their previous state.
Checkout the branch you want to mess with. Find the revision that you want in the log, then do:
$ git reset --hard abcd93
With abcd93 being whatever version you found in the log. Note though, that this will change the branch pointer.
It is usually best to spawn off a new branch, so consider
$ git checkout abcd93 -b new_branch_name
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With