Good idea mentioning reflog in this article—I never felt free and safe enough to play with the darker corners of git on production code until I found out that:
git reflog will remember all previously committed states for 90 days, no matter what you do to rewrite history.
If nothing else you can do a checkout to any of those hashes in reflog's output and hard reset / force push it as your new branch tip.
I know a force push sounds like bad advice to mention in any newbie git article, but the above operations were exactly the safety net that I (a decades-long user of CVS, TLA, and Hg) needed to really start getting creative and map out a mental model for git.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Good idea mentioning
reflog
in this article—I never felt free and safe enough to play with the darker corners of git on production code until I found out that:git reflog
will remember all previously committed states for 90 days, no matter what you do to rewrite history.I know a force push sounds like bad advice to mention in any newbie git article, but the above operations were exactly the safety net that I (a decades-long user of CVS, TLA, and Hg) needed to really start getting creative and map out a mental model for git.