Skip to main content
11 events
when toggle format what by license comment
Feb 20, 2023 at 17:30 comment added Holger Böhnke Warning: reset will not revert the commits, it will discard them (after they fall out of the reflog and a git gc). This includes a possible need to force push the result. Revert as in stack the inverse commit on top, is annihilating the changes but keeps both commits.
Mar 15, 2022 at 17:22 comment added Matt Welke This worked well for me, except I had to also do a git add before the git commit because I was left with unstaged changes after git reset --mixed d.
Feb 21, 2022 at 0:18 comment added Simon Elms git reset --hard a then git reset --soft d worked perfectly for me. It seems a neat and simple solution, much better than reverting commits b, c, and d separately. A two-step process no matter how many commits you want to revert.
Oct 12, 2020 at 16:48 comment added rogerdpack --mixed doesn't work for the case of a revert of a commit that removed a file, but --soft works well...
Feb 17, 2020 at 6:10 review Suggested edits
Feb 17, 2020 at 8:11
Jan 10, 2016 at 18:03 comment added Nate Anderson Why is git reset --mixed D required? Specifically why reset? Is it because, without resetting to D, that, HEAD would point at A, causing B, C, and D to be "dangling" and garbage-collected -- which is not what he wants? But then why --mixed? You already answered "--soft resetting doesn't move the index..." So by moving the index, this means index will contain D's changes, while Working Directory will contain A's changes -- this way a git status or git diff (which compares Index [D] to Working Directory [A]) will show the substance; that user is going from D back to A?
Aug 29, 2013 at 3:38 comment added SimplGy git checkout A then git commit above did not work for me, but this answer did.
Nov 11, 2010 at 1:56 comment added Jeff Ferland Yes, I think git reset --keep is exactly what I have above. It came out in version 1.7.1, released in April of 2010, so the answer wasn't around at that time.
Sep 25, 2009 at 14:42 comment added Jeff Ferland --soft resetting doesn't move the index, so when he commits, it would look like the commit came directly from a instead of from D. That would make the branch split. --mixed leaves the changes, but moves the index pointer, so D will become the parent commit.
Sep 23, 2009 at 5:38 comment added CB Bailey If he wants HEAD to look like A then he probably want the index to match so git reset --soft D is probably more appropriate.
Sep 23, 2009 at 0:45 history answered Jeff Ferland CC BY-SA 2.5