Git Troubleshooting
Published by O'Reilly Media, Inc.
How to solve practically any problem that comes your way
- Easily find key content in your Git repository
- Look at and understand objects in a Git repository
- Make your Git repositories as efficient and small as possible
- Roll back or undo most operations in Git
- Quickly locate the commit that first introduced a problem or change
- Identify which objects in the repository map to which files in your dev area
If you’ve been using Git for any length of time, you probably have a certain level of comfort with it. You know the commands to use to get your work done and the standard options to make that work easier. But what happens when something goes wrong, or you need to do something other than the workflow you’re used to? Or worse, what if you need to dig into the actual repository to solve a problem?
Join expert Brent Laster to gain the tools, knowledge, and hands-on experience you need to deal with many of the uncommon issues you’re likely to run into with Git, from trying to recover from or undo an operation to making strategic changes across a series of commits to learning how to save space and manage the scope and size of your repositories. Armed with this information, you’ll be in a position to deal with practically any challenge with your repositories that comes your way.
What you’ll learn and how you can apply it
By the end of this live online course, you’ll understand:
- How to recover from almost any mistake in a repository
- How to search for and quickly find content across commits
- How to map files to internal Git objects and access and work with low-level objects
- How to use rebase and related functions to precisely merge and add commits from other branches
- How to get information on the low-level attributes of your repositories (such as storage) and manage them (such as freeing up storage)
And you’ll be able to:
- Roll back or undo most operations
- Quickly locate the commit that first introduced a problem or change
- Easily find key content in your repository
- Look at and understand objects in the repository
- Identify which objects in the repository map to which files in your dev area
- Use rebase and related functionality to update and merge selected commits
- Make your repositories as efficient and small as possible
This live event is for you because...
- You’re a Git user who wants to better understand how to recover from problems.
- You’re an admin for a Git repository who needs to be able to help others with issues or problems.
- You want to become more familiar with Git’s advanced features and lower-level commands.
Prerequisites
- A computer with Git installed
- A working knowledge of Git’s basic commands and workflow
Recommended preparation:
- Take Git Fundamentals (live online training course with Brent Laster)
Recommended follow-up:
- Take Next Level Git (live online training course with Brent Laster)
Schedule
The time frames are only estimates and may vary according to how the class is progressing.
How to quickly find things in Git (35 minutes)
- Presentation: Using git grep and options to search for content across commits; using git log in various forms to get targeted change information over time; identifying who made changes to particular lines in files with git blame; using git bisect to quickly identify where a error or change was introduced in a long chain of commits and automating the process.
- Hands-on exercise: Use git bisect (including automated running) to find where an error was introduced in a set of commits.
- Q&A
Recovering from mistakes (30 minutes)
- Presentation: Recovering, undoing, and rolling back changes, including targeting specific changes for individual files and settings in commits.
- Hands-on exercise: Use filter-branch to remove a file from all commits and update the author and email address associated with a set of commits in the history; undoing and rolling back operations; dealing with ranges.
- Q&A
- Break (5 minutes)
Slicing and dicing: Rearranging content between branches (35 minutes)
- Presentation: Using git cherry-pick to surgically migrate one commit from any point in a branch to another branch; using advanced rebasing to select a range of commits from one branch to merge into another; making a subdirectory of a project into the project’s root with filter-branch and the subdirectory filter; splitting out a subset of content from a repository into another repository using the subtree command; leveraging interactive rebasing to rewrite commit history including updating commits at any point in the history.
- Hands-on exercise: Use cherry-picking and rebasing to squash to learn how to rearrange content and change history.
- Q&A
**Exporting and sharing content and repositories ** (30 minutes)
- Presentation: Using archive & bundle commands to export contents from your repository and how to create new repositories from the exported content. Using subtree options and other commands to split out sections of content from repositories, transfer sections into another branch, etc.
- Hands-on exercise: Share, export, and copy repositories and split out directories. Also create new remotes from the copies.
- Q&A
- Break (5 minutes)
**Maintenance and cleanup: Garbage collection, verification, and cleanup for your repositories ** (35 minutes)
- Presentation: Learning and using lower-level Git plumbing commands to map files to objects in Git. Finding the true sizes of your repositories. Using git gc to do garbage collection; leveraging git prune to remove dangling objects; checking disk space consumption with git count-objects; completely removing content from your repository the right way.
- Understand how Git compresses objects.
- Hands-on exercise: Map objects in a Git repository, validate and clean up a Git repository
- Q&A
Wrap-up and Q&A (5 minutes)
Your Instructor
Brent Laster
Brent Laster is an experienced technology leader and a global trainer, speaker and author. He’s also the founder and president of Tech Skills Transformations, LLC, a company dedicated to making technology understandable and usable. Throughout his career in software development and management, Brent has always made time to learn and develop both technical and leadership skills and share them with others. He believes that regardless of the topic or technology, there’s no substitute for the excitement and sense of potential that come from providing others with the knowledge they need to accomplish their goals.