I made a commit while on the (no branch) branch then did a pull, realized I was on the wrong branch and did a ‘checkout master’ and another pull. I now can’t find my original commit to push on the master branch and I can’t switch to the (no branch). Is there a way to resurrect my commit or get the diff?
Share
The
git reflogwill list for you all the commits you did, and a (for instance)git merge HEAD@{1}will merge it back into your branch.From
git rev-parse:Note that a
git rebase -iwould do the same.The Revision Selection page mentions:
The config
gc.reflogExpirespecifies when to removes reflog entries older than this time; defaults to 90 days.