I have a set of commits on a branch like so:
[head]A->B->C->D
and would checkout to commit C
but would like to review the changes made from C
to B
as uncommitted changes. I was wondering how I can do this. I would start out by doing something like this:
git checkout <hash of C>
git checkout -b new-branch
- ...the rest per advice in responses here
Thank you.
CodePudding user response:
This answer assumes that you want to end up with:
B -> C -> D
after first starting of with C -> D
and reviewing the changes from B
. We can try the following:
git reset --hard HEAD~1 # takes us back to B -> C -> D
git reset --soft HEAD~1 # back to C -> D with B's changes being staged
Once you review the staged changes and commit from the second step above, you will end up with B -> C -> D
.