Course Description
You've likely had the experience of being frustrated by git. It’s a powerful tool, but it introduces terminology and concepts that aren’t easily understood without diving deep into how git works. Learn from Nina Zakharenko -- software engineer at Venmo -- as she breaks down Git’s design philosophies and internal workings, making them straightforward and easy to follow. Master advanced techniques to manage commits and branching, rebasing vs merging, git hooks, merge conflicts, and use the GitHub API and automate workflows for building applications. A deep dive into git, this course is optimized for developers who already use git every day and want to supercharge their team collaboration and coding productivity.
This course and others like it are available as part of our Frontend Masters video subscription.
Course Details
Topics
Learn Straight from the Experts Who Shape the Modern Web
- 200+ In-depth courses
- 18 Learning Paths
- Industry Leading Experts
- Live Interactive Workshops
Table of Contents
Git In-Depth
- After reviewing the course prerequirements, Nina Zakharenko introduces her Git In-Depth course. Git is distributed version control system.
- Nina sets the course agenda and underscores the importance of using the command line to learn Git better.
Git Foundations
- Nina reviews how Git stores information comparing it to a key-value store where data is the value and the hash of the data is the key. This system is also known as content-addressable storage, which is when the content to generate the key.
- In the .git directory, Nina reviews how git stores project information and its metadata into blob, tree, and commits objects, with each object storing different parts of the project like its content and folder structure. Deleting the .git directory, the information and history of the project are gone, but not the files of the project.
- Nina reviews commits, which is an object that stores the current contents of the project in a new commit with a log message from the user describing the changes. Nina takes questions from students.
- After configuring their editor, students create a simple Git commit for this exercise. Nina takes questions from students.
- Nina walks through the Solution for the Simple Git Commit Exercise.
Git Areas and Stashing
- Nina introduces the working area, staging area, and repository (repo). The working area is where files that are not handled by git. These files are also referred to as "untracked files." Staging area is files that are going to be a part of the next commit, which lets git know what changes in the file are going to occur for the next commit. The repository contains all of a project's commits.
- Nina reviews stashing, which is saving work that is not committed to a git repo and is also safe from destructive operations. Nina takes questions from students.
- In this exercise, students examine interactive staging, unstaging files, and stashing uncommitted changes.
References, Commits, Branches
- Nina reviews references in git: tags, branches, and HEAD.
- Nina discusses tags, which is another type of reference. Lightweight tags are simple points to a commit. An annotated tag points to commit and stores additional information such as author, message, and date.
- Nina explains that a detached head occurs when a commit is checked out instead of a branch. If a commit does not point or associates to a branch, the changes will not be references in git and eventually go to garbage collection.
- In this exercise, students examine references and create some lightweight and annotated tags.
- Nina walks through solution to References Exercise.
Merging and Rebasing
- Nina introduces merging as commits which happen to have more than one parent. Fast-forward occurs when there are no commits on the base branch that happened after the feature branch was created.
- Nina explains that merge conflicts happen when files have diverged too far. After explainigng that git stops the merging until the conflicts resulting from the attempted merge are resolved, Nina reviews "git rerere" command, which reuses recorded resolutions of future conflicted merges.
- In this exercise, students look at fast-forward merge, learn how to make a non-fast-forward merge, then learn how to use git's Reuse Recorded Resolution (ReReRe) functionality to automate complex merges.
- Nina walks through the solution to Merging and ReReRe Exercise.
History and Diffs
- After discussing the pitfalls of bad or unuseful commit messages, Nina reviews policies and benefits of writing good commits.
- Nina reviews git log, the basic command that shows you the history of a repository.
- Nine discusses the show command, which allows for looking at comments and their comments, and the diff command, which shows changes between commits and more.
- In this exercise, students practice making a good commit and examine command line arguments for git log, use git show to get more information about a commit.
- Nina walks through the solution to History and Diffs Exercise.
Fixing Mistakes
- Nina reviews git checkout command, which allows for resolving mistakes by restoring working treefiles or switching branches.
- After discussing git clean command, which clears working area by deleting untracked files, Nina reviews git reset command, which removes the file from the index while keeping it in the working directory. Nina answers questions from students.
- Nina discusses git revert command, which creates a new commit that introduces the opposite changes from the specified commit while the original commit stays in the repository.
- In this exercise, students practice reverting a file and cleaning a repository.
- Nina walks through the solution to Fixing Git Mistakes Exercise.
Rebase and Amend
- Nina reviews the git amend command, which is a quick and easy shortcut to make changes to the previous commit.
- Nina introduces the rebase command. Rebase pulls in the latest changes from master and applies your commits on top of those changes by changing the parent commit of your commits.
- Reviewing the amend command, Nina reviews methods for associating changes to arbitrary commit using the fixup and autosquash flags for commit and rebase commands respectively.
- After discussing the abort command when rebasing attempts are not working, Nina reviews tips and advantages on implementing rebase.
- In this exercise, students practice amending commits, attempt a normal rebase, and an interactive rebase.
- Nina walks through the solution to Git Rebase and Amend Exercise.
Forks & Remote Repos
- After discussing talking about central vs. distributed version control, Nina discusses comparisons between git and GitHub.
- Nina reviews remotes, which is a git repository store elsewhere on the web, in GitHub, or somewhere else. Origin is the default name git gives to the server from which you cloned the project. Cloning a remote repo from a URL fetches the whole repo and makes a local copy into your .git folder.
- Nina discusses fork, which is a copy of the repo that is stored in your GitHub account. Upstream repo is the base repo created in a fork.
- Nina discusses triangular workflow when working with GitHub, tracking branches,
- In this exercise, students create a fork and set up remotes.
Danger Zone
- Nina reviews destructive operations that endanger changes lost forever.
- Nina discusses techniques to recover lost work with git and GitHub.
GitHub
- Nina demonstrates shortcuts when working on GitHub.com.
- Nina talks about continuous integration, which involves merging smaller commits more frequently allowing new features to be released quicker.
- In this exercise, students set up an example of continuous integration.
- Nina walks through the solution to Continuous Integration Exercise.
Advanced GitHub
- Nina reviews GitHub's RESTful API for making requests, create and updating issues, pull requests, and more.
- In this exercise, students use the GitHub REST API.
Wrapping Up
- Nina wraps up the course and thanks to the students.
Learn Straight from the Experts Who Shape the Modern Web
- In-depth Courses
- Industry Leading Experts
- Learning Paths
- Live Interactive Workshops