0

There is a bug appeared in commit 63aeeab. There are too many changes between b947052 and 63aeeab. I want somehow checkout 63aeeab and then discard changes one by one to find the bug. And then go back to my current commit. What is a proper way?

enter image description here

1 Answer 1

2

One option could be to checkout 63aeeab and then reset to the previous commit. In this way you return as in b947052 just before creating the next commit and all the changes introduced by 63aeeab will be in your working copy.

git checkout 63aeeab
git reset HEAD^

Note that these commands have no effects on the git tree shape, no branches are moved, no commits changed.

In this state you should be able to discard changes one by one (it could be helpful the --patch option of git checkout)

Let me say, sorry I have to do this, make small commits, add unit tests.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.