This is not absolute gospel. If you screw up a rebase and commit, whatever you removed in the rebase is simply gone.
This is not absolute gospel. If you screw up a rebase and commit, whatever you removed in the rebase is simply gone.
(That's not a git thing. I don't really even want some sort of hypothetical source control system that literally tracks every change I make. It's technically conceivable and should be practical to what would at least be considered a "medium sized" project in the git world, but I'd just be buried in the literally thousands of "commits" I'd be producing an hour. Failing that sort of feature, a source control system can't help but "lose" things not actually put into it.)
OK, so we have backups of his VM and we can recreate a clone of it, but will that be satisfactory? Are there any issues with hardware MAC addresses or CPU ids? How far down the rabbit hole of git minutiae do you have to go before you are confident that you can do all basic source-control operations safely?
is the more important imo than
git reflog
A rebase does not destroy information. It creates new commits and moves the branch head to a different spot on the graph.
The reason git is seen as painful is because you can't claim expertise until you develop the ability to form a mental map of the graph. But once you do this the lights turn on and everything starts to make sense.
This is why the mantra "commit early and often" still holds. The more experienced git user will tell the newer people this, so when they come with a mess it will always be recoverable.
reflog is like undelete in filesystems, it's a probabilistic accident recovery mechanism for an individual computer (repo checkout in this case) that you can try to use if you don't have backups.
It takes trying to do anything that's not easily recoverable as long as you commit before you start messing around and don't rm -rf .git.
Make a git log --reflog --all and you will see all the commits you made (or rebase made) in the last 3 months.
You can than rescucitate an old branch by simply putting a branch name on it with git branch newname <old sha1>