Rewriting Git History
Git’s main purpose is to keep a record without losing committed changes. However, Git also provides features that can reshape and improve a development workflow. These features include the ability to explicitly rewrite project history, but using them can also introduce the risk of losing commit information. Git provides history-rewriting commands together with warnings about the possibility of losing project contents.
This chapter explains common reasons why you may need to rewrite committed snapshots and shows how to avoid mistakes when doing so.