Skip to Content
Git in Practice
book

Git in Practice

by Mike McQuaid
September 2014
Intermediate to advanced
272 pages
8h 27m
English
Manning Publications
Content preview from Git in Practice

Chapter 6. Rewriting history and disaster recovery

This chapter covers

  • Viewing the history of all changes made to branches over time
  • Making a branch point to a previous commit
  • Changing the parent of commits to point to another
  • Forcing push-rewritten history to a remote repository
  • Rewriting the entire history of a branch
  • Avoiding losing your work

Technique 4 briefly discussed that Git is capable of rewriting the history of a repository. Because each repository contains the entire history, this ranges from undoing a single commit to rewriting data on every commit in the repository. I make use of rewriting history regularly to ensure that merged branches have a clean, readable history made up of small commits before merging. You can read ...

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 for Teams

Git for Teams

Emma Jane Hogbin Westby
Git Pocket Guide

Git Pocket Guide

Richard E. Silverman
Git: Mastering Version Control

Git: Mastering Version Control

Ferdinando Santacroce, Aske Olsson, Rasmus Voss, Jakub Narębski

Publisher Resources

ISBN: 9781617291975Supplemental ContentPublisher SupportOtherPublisher WebsiteSupplemental ContentErrata PagePurchase Link