4

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)?.

Embedded_Mugs
  • 2,132
  • 3
  • 21
  • 33
  • If you can't find a way to do this with Kraken, have a look at something like [this](http://serebrov.github.io/html/2014-01-04-git-revert-multiple-recent-comments.html) to do it directly from the Git bash. – Tim Biegeleisen May 25 '17 at 13:41
  • From the latest to the oldest revert them one by one. If you can revert the last one, then you can revert the rest four. – ElpieKay May 25 '17 at 13:53
  • @ElpieKay It can get tedious when there are several commits to revert. – Embedded_Mugs May 25 '17 at 15:09

2 Answers2

13

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)

Tom M
  • 131
  • 1
  • 4
1

Here is a more popular question with a good answer on how to solve this with git. You can derive from it how to do it in GitKraken. How to revert multiple git commits?

Silv
  • 673
  • 5
  • 19