After git reset, can you see git log before the reset?

Asked

Viewed 77 times

0

I was in the following situation, I was doing a training and I got to a point that my page was not correctly loading being different from the instructor, everything indicated a problem of CSS so I made a git log and I was doing the git reset to return to commits previous and identify where I got lost.

The problem is that when I made one git log to return again to the last commit, I realized there wasn’t any log of my commits current. By luck, scrolling the page of the Cmder, found the first git log and made a git reset using the hash latest and my project returned to last status.

Would have some way to do that without necessarily losing the logs or git reset is only for cases without back?

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

1 answer

1


Yes, it is possible to see the log after the git reset, just use the command

git reflog

The git keeps a file of log which record all modifications (commit) of the Code, irrespective of reset or not an existing amendment.

or else

git log -g

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

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


Reference:
https://git-scm.com/docs/git-reflog
https://git-scm.com/docs/git-log

  • I tested here and worked perfectly thank you.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.