How to revert to changes to previous revision using smartgit? I can't find an option there
Revert to changes to previous revision using smartgit?
Asked Answered
What exactly do you mean with "revert"? Reverse-merge or reset might help you - depending on what you mean. –
Alfonsoalfonzo
I suppose you want to return to one of the past commits.
Click on "Log" on right hand side of the window then choose the commit you want to return to and select "check out". The older version is now checked out.
Then you can commit and push that file.
... "then you can commit and push that file"... this doesn't work for me. –
Invigilate
There is no error message. Rather, nothing happens when I commit/push. I.e., the steps I tried are: (1) Checkout previous commit (opting to create a new branch and switch to it); (2) Attempt to commit/push. But for step #2, there are no files flagged as "modified", and hence there is nothing to commit/push. The only course of action is simply to switch back to the head of the master branch. Perhaps, then my step (1) is incorrect? I.e., perhaps I should not create a new branch and switch to it, but ignore the SmartGit warning and simply checkout the files directly? –
Invigilate
Note that I have worked around this by choosing the "Revert..." option multiple times; starting with the most recent previous commit and working backwards, one step at a time, through all previous commits, until arriving at the desired historical commit (each time creating a new commit containing the reversion). This did work for me, but not particularly smoothly - there was one file, in particular, that was marked as "conflicted" every time I performed a reversion, and I had to copy/paste the desired reverted version of that file by hand. But otherwise, it did go smoothly (just many steps). –
Invigilate
What do you want to do exactly? You want to return one of your previous commits? Make sure that you understand working with local and remote. If you check out one of your previous commits you cannot push it directly to remote. If you explain me what you want to do i can help you. –
Pop
When in your answer you said choose the commit you want to return to and select "check out" ... Then you can commit and push that file, I took this to mean committing and pushing an older version of the file to the remote repository (since you were discussing, in the answer, how to return to one of the past commits. My goal is to push a commit to the head of master/origin (i.e., in the remote repository) such that the commit is an exact copy of a previous commit (i.e., to revert the code to a previous commit, if I understand the word "revert" correctly). –
Invigilate
if you want to push previous commit to remote you need to choose advance option on smartGit. "Push to" + "Force Pushing". Note that this will overwrite remote you will have exact copy of your current working repository after force pushing. –
Pop
Thanks. Just to confirm - will the version on the remote repository be a new commit, or will it impact the history? –
Invigilate
I am not sure but i think you would be seeing all of the commits so far. –
Pop
This answer can have you working on a detached head. In other words, it seems to create a risk or a problem. –
Ceilidh
© 2022 - 2024 — McMap. All rights reserved.