Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Mastering Git

You're reading from   Mastering Git Attain expert-level proficiency with Git by mastering distributed version control features

Arrow left icon
Product type Paperback
Published in Aug 2024
Publisher Packt
ISBN-13 9781835086070
Length 444 pages
Edition 2nd Edition
Tools
Concepts
Arrow right icon
Author (1):
Arrow left icon
Jakub Narębski Jakub Narębski
Author Profile Icon Jakub Narębski
Jakub Narębski
Arrow right icon
View More author details
Toc

Table of Contents (21) Chapters Close

Preface 1. Part 1 - Exploring Project History and Managing Your Own Work
2. Chapter 1: Git Basics in Practice FREE CHAPTER 3. Chapter 2: Developing with Git 4. Chapter 3: Managing Your Worktrees 5. Chapter 4: Exploring Project History 6. Chapter 5: Searching Through the Repository 7. Part 2 - Working with Other Developers
8. Chapter 6: Collaborative Development with Git 9. Chapter 7: Publishing Your Changes 10. Chapter 8: Advanced Branching Techniques 11. Chapter 9: Merging Changes Together 12. Chapter 10: Keeping History Clean 13. Part 3 - Managing, Configuring, and Extending Git
14. Chapter 11: Managing Subprojects 15. Chapter 12: Managing Large Repositories 16. Chapter 13: Customizing and Extending Git 17. Chapter 14: Git Administration 18. Chapter 15: Git Best Practices 19. Index 20. Other Books You May Enjoy

What this book covers

Chapter 1, Git Basics in Practice, serves as a reminder of the version-control basics with Git. The focus is on providing the practical aspects of the technology, using an example of the development of a simple project. This chapter will show and explain basic version-control operations for the development of an example project, as well as how two developers can use Git to collaborate.

Chapter 2, Developing with Git, shows how to selectively commit files and interactively select what to commit. You will learn how to create new revisions and new lines of development. This chapter introduces the concept of the staging area for commits (the index) and explains how to view and read differences between the working directory, the index, and the current revision. It will also teach you how to create, list, and switch branches, how to go back in history, and how to revert changes or amend the last commit.

Chapter 3, Managing Your Worktrees, teaches you how to manage your files in detail to prepare content for a new commit. It will explain the concept of the index and file status, teaching you how to examine the status of your working area, how to move file contents between a worktree, index, and repository, and how to change your file status. It will also show how to manage files that require special handling, introducing the concepts of ignored files and file attributes.

Chapter 4, Exploring Project History, introduces the concept of a graph of revisions and explains how this concept relates to the ideas of branches, tags, and the current branch in Git. You will learn how to select and view a revision or a range of revisions, as well as how to refer to them. These skills will help you focus on specific parts of project history, selecting the interesting part of it for further search.

Chapter 5, Searching Through the Repository, explores how to extract the information you want from selected commits. You will learn how to limit your search according to the revision metadata, such as the contents of the commit message, or look at the changes themselves. These skills will help you focus on specific parts of project history, extract information from it, examine what changed and when, and even find bugs by using history bisection.

Chapter 6, Collaborative Development with Git, presents a bird’s-eye view of the various ways to collaborate, showing different centralized and distributed workflows, their advantages and disadvantages, and how to set them up. This chapter will focus on repository-level interactions in collaborative development. You will also learn the concept of the chain of trust and how to use signed tags, signed merges, signed commits, and signed pushes.

Chapter 7, Publishing Your Changes, examines how Git exchanges information and data between your local repository and remote repositories, describes what the choices are with respect to transport protocols, and shows how Git can help manage credentials that might be needed to access those remote repositories. This chapter also teaches you how you can send your changes upstream so that they can appear in the repository with the official history of a project.

Chapter 8, Advanced Branching Techniques, dives deeper into the details of collaboration in distributed development. It explores the relationships between local branches and branches in remote repositories and describes techniques to synchronize branches and tags. You will learn the different patterns when using branches, including a trunk-based workflow and a topic branch (also called a feature branch) workflow, their advantages and disadvantages, and when to use them.

Chapter 9, Merging Changes Together, teaches you how to merge together changes from different parallel lines of development (that is, branches) using merge and rebase (and squash merge). This chapter will also explain the different types of merge conflicts, how to examine them, and how to resolve them. You will learn how to copy changes with cherry-pick and how to apply a single patch and a patch series.

Chapter 10, Keeping History Clean, explains why you might want to keep a clean history, when it can and should be done, and how it can be done. You will find step-by-step instructions on how to reorder, squash, and split commits. This chapter also demonstrates how you can recover from a history rewrite and explains what to do if you cannot rewrite history, how to revert the effect of commit, how to add a note to it, and how to change the view of a project’s history with a replacement mechanism.

Chapter 11, Managing Subprojects, explains and shows different ways to connect different projects in a single repository of a framework superproject, from a strong inclusion by embedding the code of one project in another (monorepos and subtrees) to a light connection between projects by nesting repositories (submodules and similar solutions).

Chapter 12, Managing Large Repositories, presents various solutions to the problem of large Git repositories, whether they are large because of a long history, contain a large number of files, or contain a project that includes some large files.

Chapter 13, Customizing and Extending Git, covers configuring and extending Git to fit your needs. You will find here details on how to set up the command line for easier use and a short introduction to graphical interfaces. This chapter explains how to automate Git with hooks (focusing on client-side hooks) – for example, how to make Git check whether a commit being created passes specific coding guidelines.

Chapter 14, Git Administration, focuses on the administrative side of Git. It briefly touches on the topic of serving Git repositories. Here, you will learn how to use server-side hooks for logging, access control, enforcing a development policy, and other purposes.

Chapter 15, Git Best Practices, presents a collection of version-control, generic and Git-specific recommendations and best practices. These cover issues such as managing the working directory, creating commits and a series of commits (pull requests), submitting changes for inclusion, and a peer review of changes.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image