Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Undo git commit with TortoiseGit

I'm using TortoiseGit in Windows for my git projects.

I made a local commit on my project. And I want to undo it.

How to undo git commit with TortoiseGit? without discarding my changes

like image 359
MOHAMED Avatar asked Apr 25 '14 10:04

MOHAMED


People also ask

Can I revert commit from remote branch?

If you have a commit that has been pushed into the remote branch, you need to revert it. Reverting means undoing the changes by creating a new commit. If you added a line, this revert commit will remove the line. If you removed a line, this revert commit will add the line back.

Is TortoiseGit same as git?

TortoiseGit is a Windows Shell Interface to Git and based on TortoiseSVN. It's open source and can fully be build with freely available software. Since it's not an integration for a specific IDE like Visual Studio, Eclipse or others, you can use it with whatever development tools you like, and with any type of file.


1 Answers

Undo last commit: Reset

enter image description here

and

enter image description here

[NOTE] if you want to keep working tree changes, use Mixed instead.

the result:

enter image description here


Undo/Remove the commit which is not the last one: Rebase with Force

enter image description here

and

enter image description here

(You may hit the conflicts, but how to resolve the conflicts is another story. :P )

and

enter image description here

the result:

enter image description here

like image 109
Yue Lin Ho Avatar answered Sep 29 '22 07:09

Yue Lin Ho