V
V
Vladislav Kolotsei2016-01-11 14:07:33
Java
Vladislav Kolotsei, 2016-01-11 14:07:33

How to rollback multiple git commits in eclipse?

There were some troubles with the commits. Thoughtlessly created several commits of one task, now you need to roll back to the previous one. The photo below shows the history in git, you need to rollback to the Collections 4 task. How can this be done?
74fd655e960d4d9893c5e5835dd352ff.JPG

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
aol-nnov, 2016-01-11
@vlady_32

git reset --hard 96109b4

E
Eugene, 2016-01-11
@JPascal

git checkout [good commit id]
git branch new-branch
git push new-branch origin master -f
git checkout master
git branch -d new-branch
git fetch master
Something like this, I'm writing from a mobile phone, there may be typos. But this is not a good option. It's better to just fix the branch and move on.

A
abcd0x00, 2016-01-12
@abcd0x00

First you make a branch or tag to hold those wrong commits, then you rollback master.

git branch incorrect
git reset HEAD~3

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question