Book description
Learn to track, branch, merge, and manage code revisions for real-world development scenarios
Key Features
- Master Git and maintain your projects better through version control
- Get to grips with Git’s typical workflows, advanced functions, and their implementations
- Learn the key Git commands to better manage your repository
Book Description
Whether you’re looking for a book to deepen your understanding of Git or a refresher, this book is the ultimate guide to Git.
Git for Programmers comprehensively equips you with actionable insights on advanced Git concepts in an engaging and straightforward way. As you progress through the chapters, you’ll gain expertise (and confidence) on Git with lots of practical use cases.
After a quick refresher on git history and installation, you’ll dive straight into the creation and cloning of your repository. You’ll explore Git places, branching, and GUIs to get familiar with the fundamentals. Then you’ll learn how to handle merge conflicts, rebase, amend, interactive rebase, and use the log, as well as explore important Git commands for managing your repository.
The troubleshooting part of this Git book will include detailed instructions on how to bisect, blame, and several other problem handling techniques that will complete your newly acquired Git arsenal.
By the end of this book, you’ll be using Git with confidence. Saving, sharing, managing files as well as undoing mistakes and basically rewriting history will be a breeze.
What you will learn
- Create remote and local repositories and learn how to clone them
- Understand the difference between local and remote repositories
- Use, manage, and merge branches back into the main branch
- Utilize tools to manage merge conflicts
- Manage commits on your local machine through interactive rebasing
- Use the log to gain control over all the data in your repository
- Use bisect, blame, and other tools to undo Git mistakes
Who this book is for
If you have basic understanding of Git and want to strengthen your command over advanced techniques and navigate different functions, this book is for you. Knowing the fundamentals of Git will help you get the most out of this book, but beginners willing to invest some extra effort will be able to follow along as well.
Table of contents
- Preface
- Introduction
- Creating Your Repository
- Branching, Places, and GUIs
-
Merging, Pull Requests, and Handling Merge Conflicts
- Merging overview
- What's in that push?
- GitHub Desktop
- Merge conflicts
- Avoiding conflicts
- Summary
- Challenge
-
Answer
- Task #1: Set up a new repository and clone it to two different folders
- Task #2: Have one person populate the main branch with the beginnings of UtilityKnife, commit the changes, and push it
- Task #3: Each programmer creates a feature branch. Each programmer then puts the beginning of their feature into their branch, committing frequently (more frequently than you would in "real life")
- Task #4: Merge the main branch into the feature branch frequently to ensure that if there are conflicts, you catch them early
- Task #5: John is building the temperature converter. Have him "borrow" code from the calculator. See if there are merge conflicts
- Rebasing, Amend, and Cherry-Picking
- Interactive Rebasing
- Workflow, Notes, and Tags
- Aliases
- Using the Log
- Important Git Commands and Metadata
- Finding a Broken Commit: Bisect and Blame
-
Fixing Mistakes
- You wrote the wrong message in the last commit
- You forgot to add changed files from your last commit
- Problems with the order of commits or their messages
- You need to undo changes made in a commit
- You misnamed your branch
- You committed to the wrong branch
- You trashed a file in a previous commit
- You messed up the remote by pushing a broken branch
- Quiz
-
Answers
- What do you do if you left out a changed file in the last commit?
- What do you do if you committed to the wrong branch?
- What do you do if you corrupted a file in a previous commit?
- What do you do if you need to undo changes made in a commit?
- What do you do if you trashed Master by pushing a broken branch?
- Next Steps
- Other Books You May Enjoy
- Index
Product information
- Title: Git for Programmers
- Author(s):
- Release date: June 2021
- Publisher(s): Packt Publishing
- ISBN: 9781801075732
You might also like
book
Version Control with Git, 2nd Edition
Get up to speed on Git for tracking, branching, merging, and managing code revisions. Through a …
book
Git Essentials - Second Edition
Dive and explore into the latest addons of the latest Git. About This Book Master all …
video
Git Essentials for Beginners
Version Control has always been part of the software development lifecycle to facilitate programmers to restore …
video
Git Essentials LiveLessons, 2nd Edition
6 Hours of Video Instruction Hands-On Approach to Learning the Git Version Control System Overview provides …