Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
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

A brief introduction to version control and Git

A version control system (sometimes called revision control) is a tool that lets you track the history and attribution of your project files over time (stored in a repository) and helps the developers in the team to work together. Modern version control systems give each developer their own sandbox, preventing their work in progress from conflicting, and all the while providing a mechanism to merge changes and synchronize work. They also allow us to switch between different lines of development, called branches; this mechanism allows the developer to change, for example, from working on introducing a new feature step by step to fixing the bug in an older, released version of the project.

Distributed version control systems (such as Git) give each developer their own copy of the project’s history, which is called a clone of a repository. This is what makes Git fast, because nearly all operations are performed locally. It is also what makes Git flexible because you can set up repositories in many ways. Repositories meant for development also provide a separate working area (or a worktree) with project files for each developer. Git’s branching model enables cheap local branching, allowing the use of branches for context switching by creating sandboxes for different tasks. It also makes it possible to use a very flexible topic branch workflow for collaboration.

The fact that the whole history is accessible allows for a long-term undo, rewinding to the last working version, and so on. Tracking ownership of changes automatically makes it possible to find out who was responsible for any given area of code, and when each change was done. You can compare different revisions, go back to the revision a user is sending a bug report against, and even automatically find out which revision introduced a regression bug (with git bisect). Tracking changes to the tips of branches with reflog allows for easy undo and recovery.

A unique feature of Git is that it enables explicit access to the staging area for creating commits (new revisions—that is, new versions of a project). This brings additional flexibility to managing your working area and deciding on the shape of a future commit.

All this flexibility and power come at a cost. It is not easy to master using Git, even though it is quite easy to learn its basic use. This book will help you attain this expertise, but let us start with a reminder about the basics of Git.

You have been reading a chapter from
Mastering Git - Second Edition
Published in: Aug 2024
Publisher: Packt
ISBN-13: 9781835086070
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