Git is so much more than a chronological ledger of changes. You might use Git as a collaboration tool to synchronize code changes between developers, but are you capturing the growth of your codebase? In this video, we’ll go over techniques that you can use in your projects to elevate the history of your codebase as a valuable source of context and evolution.
The basic usage of Git is focused on syncing code between developers and deploying code to production. But your repository is an untapped trove of context and evolution. In this section, we’ll talk about why Git is a more helpful collaboration tool when it’s not used as a verbatim ledger of changes.
Using rebasing to update the basis for your feature branch is a useful tool when incorporating new commits from the production branch. In this section, we’ll go over what rebasing is, how to use it, and how it can streamline the process for getting code changes into your feature branch.
You might be used to merging code changes from your production branch into your feature branch, but what about rebase merging? In this section, we’ll outline the differences between traditional merging and rebase merging and how using rebase merging makes for a clean and clear commit history in your production branch.
The final trick—interactive rebasing! This Git tool allows you to carefully curate your commit history to optimize the readability of your feature branch’s commit history. In this section, we’ll go over how you can use interactive rebasing to modify the commit history in non-production branches.
Advanced Techniques in Git — The Official Repo
Ready to take these new techniques for a spin? Check out the official companion repository to try out some of the tricks you’ve learned, including rebasing, interactive rebasing, commit history curation, and cherry-picking.
Before you venture into the unknown, heed these words of advice! We’ll go over how combining multiple commits is easier than splitting single commits apart and talk about the Git Reference Log—your safety net for when interactive rebasing goes wrong.
Looking for more information? Check out these helpful resources:
- In “How (and why!) to keep your Git commit history clean,” Kushal outlines the benefits of keeping commit history clear and concise.
- In “To Squash or Not to Squash?,” Divya covers some of the basics of rebasing and merge rebasing.
- In “Merging vs. Rebasing,” our friends at Atlassian talk about the differences between traditional and rebase merging and outline the uses of interactive rebasing.
- In “Git is a SHA Management Tool,” Melissa takes a technical deep-dive into Git SHAs and how they’re used with the Git reference log.