O'Reilly logo

Pragmatic Version Control Using Git by Travis Swicegood

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Undoing Changes

Hindsight is 20/20, or so they say. Working with your code is no exception. You commit a change and then realize it had a password in it that you shouldn’t be sharing.

In a centralized repository where every change is sent back to a main repository, you are almost out of luck. There are some hoops you can jump through if you have administrator access, but it might well corrupt data.

Git plans for this type of mistake, however. All your changes happen locally and are shared only when you push them to a public repository. Since you’re the only one who has to stay in sync, you can rewrite your history as much as you want!

Dangers of Rewriting History

Before we start, a word of caution: be careful how you use the commands in ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required