After git reset, how do you see git log prior to reset?

0

I was in the following situation, I was doing a training and I arrived at a point that my page was not loading correctly, being different from the instructor, it indicated a CSS problem so I made a git log and went making git reset to go back to previous commits and identify where I got lost.

The problem is that when I made a git log to go back to the last commit , I realized that there was no log of my commits current. Luckily, by scrolling the Cmder page, I found the first git log and made a git reset using the latest hash and my project returned to the last status. p>

Would there be any way to do this without necessarily losing logs or git reset is only for non-return cases?

For this my need I should have used git checkout <hash> previous?

    
asked by anonymous 24.03.2018 / 17:56

1 answer

1

Yes, you can see log after git reset , just use the

git reflog

The git maintains a log file that records all the changes ( commit ) of the code, regardless of reset or not existing change.

or

git log -g

This command is a shortcut to git log --walk-reflogs and does basically the same as the previous command.

Another option is to open the file .git\logs\refs\heads\<nome-do-branch> . This file contains all logs

Reference: link a
link     

24.03.2018 / 18:34