I have 5 commits like 1 2 3 4 5 So if I revert 3rd commit what will happen 1 and 2 commits also revert back or still remain as is
Asked
Active
Viewed 49 times
-2
-
3Possible duplicate of [What's the difference between Git Revert, Checkout and Reset?](https://stackoverflow.com/questions/8358035/whats-the-difference-between-git-revert-checkout-and-reset) – phd Jun 09 '18 at 20:05
-
*all* commits stay as they are. You get a 6th commit apllying the changes of commit 3 in reverse. – Timothy Truckle Jun 09 '18 at 20:06
1 Answers
1
As stated in the git docs, git revert will 'revert the changes that the related patches introduce'.
Using your example, all the commits will stay the same (even, slightly confusingly, commit 3) but a sixth commit will be added that undoes the changes made in commit 3.

sedders123
- 791
- 1
- 9
- 19