Welcome to our new Git screencast! This one is all about digging yourself out when things go South.

You might be unaware of this, but one of Git’s core design tenets is how you should be able to tweakyour version history in pretty much any imaginable way. Basically, the only real constraints on a Git-managed projects come from the people and organizations, not Git itself.

One of the main benefits of Git is how it lets you rollback, undo ongoing work or walk back in your history.

I’m saying that anything Git ever sees, be it an index entry or a commit, can eventually be cancelled, undone, or applied again.

So you can get stuff wrong, make a typo, use an incorrect command or generally make a mess of things: Git will always help you land right back on your feet.

If you know enough about Git, you’re probably thinking that “undo” can mean a gazillion things with Git, and indeed you’re right. This could mean unstaging changed, unmerging branches, rolling back a rebase, a pull, a cherry-pick, and much, much more. So let’s dive in and see what our tools are, what we can do with these, and how to go about it.

“Git undo” or the art of rolling back

Relax! Git makes it easy to get back seemingly lost work and dig yourself out of even the most delicate situations.

Already enrolled?
Sign in to continue learning.