T
T
T4-1002015-02-04 18:09:15
git
T4-100, 2015-02-04 18:09:15

How to go forward in git?

Let's say I have 5 commits. I'm at the last commit (5), I want to restore the files to the state at 3 commit, I do git reset --hard 3. Then I decided that I want to go back to the 5th commit, but the git log only shows commits up to 3. How do I get there in the 5th commit?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Stanislav Fateev, 2015-02-04
@isawillbenice

Try:
git reflog
then
git reset --hard <commit hash>

D
Demonist, 2015-02-04
@Demonist

Git uses checkout to navigate between commits . If you didn't do anything after reset , you can undo it by executing git reset [email protected]{1} . If you did something, then follow the advice of Stanislav Fateev .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question