Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I revert multiple commits in Git Kraken?

I know you can revert a single commit and right-clicking the commit and clicking revert. But is there a way to revert multiple commits (like the latest five commits on a single branch)?.

like image 367
Embedded_Mugs Avatar asked Feb 05 '23 09:02

Embedded_Mugs


1 Answers

you could revert back to the commit you want and force-push it, but that would destroy some of your history, which is what you usually want to avoid while working in GIT

There's another much better way to do it in GitKraken: let's say this is your commit history A - B - C - D (D being the latest commit) now you want to revert B,C&D

  1. reset hard to A (make sure you stash any open changes before doing that)
  2. reset soft to D (yes, resetting to a later commit is actually possible)
  3. write your commit message and commit

now your history should look like this A - B - C - D - A' (A' having the same content as A)

like image 60
Tom M Avatar answered Feb 07 '23 08:02

Tom M