![]() Git checkout will be the more appropriate command for this scenario, by allowing to observe and branch out of a previous commit, while keeping all the changes and history intact. If I understood the question correctly, git reset violates what's asked for in the original question, as quoted: "I would just simply like to go back with the option of going forward again". Git reset is a destructive command that deletes changes following the target commit (commit-hash when running git reset or the latest commit when running git reset). For example: git reset f7823ab -hardĪ strong caveat should be given before considering using git reset. To get the original state of the commit that you want to 'revert', you have to pass -hard. So, all changes made, since that commit you reset to, will still be there. Have in mind that, by default, the option -mixed is passed to git reset. Or to a specific commit by git reset f7823ab Git Flow is not a magic word Im after, since we just share the Developer -branch. So I need to roll it back to not break others work as well. And it could take hours, days, weeks before I make the last commit. ![]() Or some more commits (for example 3) by git reset HEAD^3 A coworker makes a commit, and merges it in, and his code breaks because mine didnt work. You will go back to the previous commit with git reset HEAD^ ![]() Most clients provide this in their UI using the same vocabulary (usually, you are able to select a commit and reset to it via context menu). To mention a few (that support git reset): GitHub Desktop is more of a tool to synchronize your repositories and not a full featured GUI client.īut that doesn't mean you have to use the command line, since there are alternatives. How to go back to previous version in git. But git revert will actually add another commit which does exactly the opposite as the original commit. This is not possible with GitHub Desktop. With git reset you really throw away all those commits and you result at exactly the given commit. ![]() In general, you can go back to a commit in your history with git reset. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |