Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Comments on How to revert main branch to an earlier commit in git?
Post
For another perspective, I use TortoiseGit (https://tortoisegit.org/) on Windows a fair bit:
-
Checkout the branch.
-
Open the log window (Git Show log).
-
Right-click on the commit/branch that you want to reset to, and choose Reset...:
-
In that dialog, you can choose soft, hard, or mixed reset. I usually pick hard.
-
Once done, pushing may be troublesome like lizuki said, but if no one else has pushed that branch in the meantime, I like to push with the "force with lease" option checked. With it checked, you can only push if there are no new (as in, from other people) commits on the branch on the remote. But if you need to force it, just coordinate with others working off that branch.
0 comment threads