O'Reilly logo
live online training icon Live Online training

Next Level Git

Master rerere, bisect, subtrees, filter branch, worktrees, submodules, and other advanced features

Brent Laster

Git has an immense collection of power operations and techniques that can help you simplify your development process and deal with the challenges that today’s multi-branch and multi-repository projects often demand. There's no need to spend time reinventing the wheel or working around Git. Get ready to learn about some of Git's lesser-known features, how Git can help you be more productive, and how managing your source code can be easier than ever.

Instructor Brent Laster explains how to take your Git skills to the next level as he reveals Git's advanced functionality and useful techniques— some which have existed in Git for years and some that were included in very recent versions. By the end of this course, you'll be confident in your ability to use advanced Git features and you'll know how to simplify your workflow more than you ever thought possible.

What you'll learn-and how you can apply it

You will understand:

  • What Git is, the core ideas and overall design behind it.
  • Strategies for being able to effectively use Git to simplify source code management and related workflows.

And you will be able to:

  • Use advanced Git functionality to manage source code
  • Increase productivity and simplify development workflows using Git's advanced techniques and lesser-known features.

This training course is for you because...

You already possess a basic understanding of Git, and

  • You're a developer with code to manage and you need to use a source management tool that empowers you instead of getting in your way.
  • You're a manager or project manager with deadlines and need to understand how to access and examine code in a Git repository.
  • You're a tester with test cases to manage and you need a way to manage your tests in source control easily.

About your instructor

  • Brent Laster is a global trainer, author, and speaker on open source technologies as well as a senior R&D manager at a top technology company. He has been involved in the software industry for more than 25 years, holding various technical and management positions.

    Brent has always tried to make 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.

Schedule

The timeframes are only estimates and may vary according to how the class is progressing

Day 1

Segment 1 – Git core concepts refresh ( 30 min) - Instructor will present an overview of some key Git concepts including distributed vs. centralized source management, the Git promotion model, and merging and rebasing. - Students will gain a reminder and/or understanding of core concepts they need to know for the rest of the class.

Segment 2 – Useful commands for retrieving previous content (20 min) - Instructor will present an overview of the following Git commands: stash, reset, and revert with an emphasis on use cases for each. - Students will gain an understanding of these commands, their functionality, utility and how to make use of them in their everyday workflows.

Break (10 min)

Segment 3 – Rerere (reuse recorded resolution) (20 min) - Instructor will cover the Git rerere command with an explanation of what the command does, options, use cases, and examples. - Students will gain an understanding of the rerere command and how to make use of it to simplify their workflow when working with Git.

Assignment: Using rerere. Students will learn how to use rerere to teach Git how to resolve merges automatically.

Assignment time: 15 min

Segment 4 – Bisect (10 min) - Instructor will cover the Git bisect command with an explanation of what the command does, options, use cases, and examples. - Students will gain an understanding of the bisect command and how to make use of it to simplify their workflow when working with Git.

Assignment: Using bisect. Students will learn how to use bisect to quickly identify the commit that introduced a problem.

Assignment time: 10 min

Break (10 min)

Segment 5 – Worktrees (15 min) - Instructor will explain how to create and work with worktrees in Git to allow for parallel work on different branches. This will include an explanation of what the command does, options, use cases, and examples. - Students will gain an understanding of what worktrees are in Git, and how to create and use them for working on multiple branches at once.

Assignment: Working with worktrees. Students will gain experience with using worktrees to simplify working on multiple branches at the same time.

Assignment time: 10 min

Segment 6 – Submodules (20 min) - Instructor will explain what submodules are and go into detail on how they relate to other Git projects, how to update them, their benefits, and how to keep them in sync. - Instructor will explain the issues surrounding using submodules. - Students will gain an understanding of what submodules are and the benefits, complexity and challenges associated with using them.

Assignment: Working with submodules. Students will gain experience with creating, updating, and maintaining submodules in Git.

Assignment time: 15 min

Day 2

Segment 7 – Subtrees (20 min) - Instructor will explain what subtrees are and how they differ from submodules. - Instructor will explain how to add subtrees to a project, update them, and merge them. - Instructor will explain the difference between subtrees and the subtree merge strategy in Git. - Instructor will explain how to use the subtree functionality to create a new project from split content. - Students will gain an understanding of what subtrees are, how they differ from submodules, how to add them to a project, and how to update them. - Students will learn how to split content into a separate project using subtree functionality.

Assignment: Working with subtrees. Students will gain experience with creating, updating, and maintaining subtrees in Git.

Assignment time: 10 min

Segment 8 – Filter-branch (20 min) - Instructor will explain how to use the Git filter-branch plumbing command to rewrite history in Git using several of the built-in filters that the command provides. - As a subtopic, instructor will explain the rev-list command, which provides a way to list out revisions based on a range or criteria. - Students will learn how to use the filter-branch command to split a subdirectory into a separate repository. - Students will learn how to use to use filter-branch to delete a file from all versions in a repository and change the email address on versions in Git history.

Assignment: Working with filter-branch. Students will use filter-branch to split out a subdirectory into a separate repository, remove a file from the history, and change the email address on a series of commits.

Break (10 min)

Assignment time: 15 min

Segment 9 – Interactive rebase (10 min) - Instructor will explain how to use the Git interactive rebase functionality to alter commits in various ways. - Students will learn how to use interactive rebase, including what each of the available subcommands does.

Assignment: Interactive rebase. Students will use the interactive rebase functionality to squash multiple commits down into one.

Assignment time: 10 min

Segment 10 – Supporting files (20 min) - Instructor will discuss the Git attributes file and how it can be used to identify binary files, specify line endings for file types, implement custom filters, and have Git ignore specific file paths during merging. - Instructor will explain the use and structure of the Git ignore file to identify files and directories that should not be processed by Git. - Students will learn all of the ways to use the Git attributes and Git ignore files as outlined above.

Assignment: Leveraging a Git Attributes file. Students will implement a Git attributes file to do some custom filtering.

Assignment time: 15 min

Segment 11 – Other useful commands (10 min) - Instructor will discuss the Git notes command and how to use it to augment information about commits. - Instructor will discuss the Git grep command and how to use it to locate information within a Git repository. - Students will understand how to use the notes and grep commands.

Segment 12 – Customizing and extending Git’s functionality with hooks (20 min) - Instructor will discuss the different types of hooks that Git supports and how they can be invoked and leveraged. - Instructor will provide examples of hooks written in different programming languages. - Students will gain an understanding of the different hooks available in Git and how they can be leveraged with different programming languages.

Assignment: Writing a simple hook. In this lab, students will create a simple Git hook, install it, and see it in action.

Assignment time: 15 min