Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to revert a particular commit using TortoiseGit?

I have a repo named messaging parent. Initially the version of this repo was 1.1.0 . Then it was upgraded to 1.2.0 with some changes. Now we have pushed some more changes on top of this version. For some reason the commit where the version was changed from 1.1.0 to 1.2.0 with some changes has to be reverted. Is it possible to revert that commit but still keep our latest changes which we pushed on top of that? There are no conflicting files in both the commits

like image 508
Pavan Rajan Avatar asked Dec 08 '22 16:12

Pavan Rajan


1 Answers

yes, you can: TortoiseGit -> Show Log, then select this commit, press right button and select from context menu: Revert Change by this commit.

enter image description here

New commit will be created, which revert this commit, all other commits are staying untouched.

From atlassian git revert:

The git revert command undoes a committed snapshot. But, instead of removing the commit from the project history, it figures out how to undo the changes introduced by the commit and appends a new commit with the resulting content. This prevents Git from losing history, which is important for the integrity of your revision history and for reliable collaboration.

like image 145
Alexan Avatar answered Dec 11 '22 09:12

Alexan