git reflog used for?git reflog shows a log of all recent changes to the HEAD, including commits, resets, and checkouts. It helps find lost commits.
git reflog?Find the commit hash in git reflog, then use git checkout <commit-hash> or git reset --hard <commit-hash> to restore it.
git reset --hard <commit-hash> do?It moves the current branch to the specified commit and resets the working directory and staging area to match that commit, discarding changes.
Commits can become lost after actions like git reset, git rebase, or branch deletion, but they still exist in reflog for a time.
By default, reflog entries are kept for 90 days before they expire and are removed.
git reflog shows recent HEAD changes, helping find lost commits.
git checkout <commit-hash> lets you move to that commit to recover it.
git reset --hard <commit-hash> do?This command moves the branch pointer and resets files to the specified commit.
git log but visible in git reflog?Resetting or changing branches can hide commits from git log but reflog still tracks them.
Git keeps reflog entries for 90 days by default before cleaning them up.