9.4 Using the Reflog

One of the key tenets that Linus set for Git was that it had to be safe. Being nondestructive means you have to be able to get back to any state in the repository, and to do that, you need to have some mechanism for tracking the changes in state.

The normal history of a repository will protect you in all but the most extreme cases with a normal version control system. Git allows you to do things that most VCSs can’t. Changing the order of commits, breaking one commit into multiple commits, removing commits, adding extra ones—these are all tasks that Git does that a VCS like Subversion or CVS can’t.

Of course, with all this power comes some risk. What happens when you accidentally delete a branch using git branch -D or ...

Get Pragmatic Version Control Using Git now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.