Book Image

Git Version Control Cookbook - Second Edition

By : Kenneth Geisshirt, Emanuele Zattin(EUR), Aske Olsson, Rasmus Voss
Book Image

Git Version Control Cookbook - Second Edition

By: Kenneth Geisshirt, Emanuele Zattin(EUR), Aske Olsson, Rasmus Voss

Overview of this book

Git is one of the most popular tools for versioning. With over 100 practical, self-contained tutorials, this updated version of the bestselling Git Version Control Cookbook examines the common pain points and best practices to help you solve problems related to versioning. Each recipe addresses a specific problem and offers a proven, best-practice solution with insights into how it works. You’ll get started by learning about the Git data model and how it stores files, along with gaining insights on how to commit changes to a database. Using simple commands, you’ll also understand how to navigate through the database. Once you have accustomed yourself to the basics, you’ll explore techniques to configure Git with the help of comprehensive examples and configuration targets. Further into the book, you’ll get up to speed with branches and recovery from mistakes. You’ll also discover the features of Git rebase and how to use regular Git to merge other branches. The later chapters will guide you in exploring Git notes and learning to utilize the update, list, and search commands. Toward the concluding chapters, you’ll focus on repository maintenance, patching, and offline sharing. By the end of this book, you’ll have grasped various tips and tricks, and have a practical understanding of best-practice solutions for common problems related to versioning.
Table of Contents (19 chapters)
Title Page
Copyright and Credits
Packt Upsell
Contributors
Preface
Index

Introduction


With the distributed nature of Git and the many existing hosting options available for it, it's very easy to share history between machines when they are connected through a network. In cases where the machines that need to share history are not connected or can't use the supported transport mechanisms, Git provides other methods to share history.

Git provides an easy way to format patches from existing history, sending them in an email and applying them to another repository. Git also has a bundle concept, where a bundle that contains only part of the history of a repository can be used as a remote for another repository. Finally, Git provides a simple and easy way to create an archive for a snapshot of the folder/subfolder structure of a given reference.

With the different methods provided by Git, it is easy to share history between repositories, especially where the normal push/pull methods are not available.