I wanted to rollback to the last commit after making a massive error, but I managed to rollback a little too fair. The commit I wanted to reassert doesn't appear when I enter 'git log' in bash (I suppose because it's no longer in the history). Is there any way I can recover the last commit by date?
I'm also using eGit in eclipse for the same project if that makes things easier. Thanks.
You would also be able to do git reset --hard HEAD@{1} and then come back to egit and rollback to the desired commit. Show activity on this post. I find that generally it's better to make your changes forward in time rather than backward. Git's approach is to "revert" the commit.
To undo changes associated with a specific commit, developers should use the git revert command. To undo every change that has happened since a given commit occurred, use git reset.
Challenge - use git reset then checkout to undo changes Save your changes (if you're in a text editor). Use git add to stage your changes to the README.md file. Undo the commit that you made using git reset . Then revert back to the previously committed version using git reset .
If you are ok with command line, go to you repo, do a git reflog
and get the commit which you want to "rollback" to and do a git reset --hard <commit>
You would also be able to do git reset --hard HEAD@{1}
and then come back to egit and rollback to the desired commit.
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