Skip to Content
Git: Mastering Version Control
book

Git: Mastering Version Control

by Ferdinando Santacroce, Aske Olsson, Rasmus Voss, Jakub Narębski
October 2016
Beginner
861 pages
20h 37m
English
Packt Publishing
Content preview from Git: Mastering Version Control

Chapter 8. Recovering from Mistakes

In this chapter, we will cover the following topics:

  • Undo – remove a commit completely
  • Undo – remove a commit and retain the changes to files
  • Undo – remove a commit and retain the changes in the staging area
  • Undo – working with a dirty area
  • Redo – recreate the latest commit with new changes
  • Revert – undo the changes introduced by a commit
  • Reverting a merge
  • Viewing past Git actions with git reflog
  • Finding lost changes with git fsck

Introduction

It is possible to correct mistakes made in Git the with git push context (without exposing them if the mistake is found before sharing or publishing the change). If the mistake is already pushed, it is still possible to undo the changes made to the commit that introduced the mistake. ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Git Version Control Cookbook - Second Edition

Git Version Control Cookbook - Second Edition

Kenneth Geisshirt, Emanuele Zattin(EUR), Aske Olsson, Rasmus Voss
Git Pocket Guide

Git Pocket Guide

Richard E. Silverman

Publisher Resources

ISBN: 9781787123205Supplemental Content