Confirm Download

Simultaneous file downloading works best in FireFox, Chrome, and Safari browsers. Please keep this window open until all downloads are complete. Some customers prefer using file download managers for Chrome or Firefox to better manage large and multiple file downloads.

Cancel Download

Collaborating with Git

      • Getting Started with Hosted Git Repositories  (Free)

        GitLab is a free code-hosting platform that allows you to create private and public repositories. It's also an open source product you can install behind your own firewall if you're working with a large team. In this section, you will learn how to setup GitLab.
      • 00:00:51

      • Creating a GitLab Account  (Free)

        To begin with GitLab, you will need to start by creating an account. This account will be used throughout the remainder of the video lessons. If you already have a GitLab account, proceed to the next lesson.
      • 00:01:44

      • Adding Your SSH Keys  (Free)

        SSH keys are a way to identify trusted computers, without using passwords. When you are using code hosting systems, these SSH keys will allow you to effectively "log in" to the system and either retrieve, or save code as if you had logged into to your account. By the end of this lesson, you will be able to locate and add your SSH keys to GitLab. If do not have SSH keys already, you will also be able to create a new SSH key pair.
      • 00:04:15

      • Forking Your First Project

        To be able to upload your changes in your repository you will need to create a copy of the project. By the end of this lesson, you will be able to create a fork of a remote repository using GitLab.
      • 00:02:00

      • Privatizing Your Repository

        Private repositories are useful if you want to hide your code from the world. For example, your client work will often be private work. In this lesson you will learn how to create a private repository on GitLab so that you can learn with privacy.
      • 00:01:37

      • Overview of Permission Strategies

        Whether or not you are allowed to upload your changes to a repository will be dictated by the permission strategy that has been used. In this lesson, you will learn about four common permission strategies: centralized, patched, forked, and branched; and be able to choose the most appropriate strategy for your project.
      • 00:08:19

      • Downloading a Remote Repository

        Working with Git at the command line might seem a little overwhelming at first, but this gives you more help, as it's easier to follow precise instructions; and share error messages with others if you run into problems. In this section you will learn how to use the command line to download a repository and review its history.
      • 00:05:34

      • Reviewing History with Git Log

        The history of your project is captured in the individual commits a developer makes over time. If it's a multi-developer project, the commits might be collaborated on by a number of people before they are incorporated into the project. By the end of this lesson, you will be able to review the commit history for a local repository using the log command.
      • 00:07:22

      • Configuring Git

        Before you can begin making commits with Git, you will need to complete some basic configuration steps. In this section, you will learn how to identify yourself to git, and enhance the command line experience by color-coding the on-screen messages.
      • 00:02:37

      • Identifying Yourself

        In order to get credit for your work, you'll need to tell Git who you are. We'll store this setting globally. As it's a global setting, you don't need to be in a specific repository to make the change. By the end of this lesson, you will be able to add your name and email to Git for proper attribution in commit messages.
      • 00:04:48

      • Changing the Commit Message Editor

        By default, Git uses Vim as its default commit message editor. By the end of this lesson, you will be able to change the default text editor for commit messages. Remember though, the commit process will only finish when you QUIT the editor, so you'll want to use a fairly lightweight editor that doesn't take forever to start and quit.
      • 00:02:41

      • Adding Color

        Reading huge walls of text can be difficult. By the end of this lesson, you will be able to enable the color hinting to show branch colors and diffs by color.
      • 00:04:47

      • Getting Started as a Team of One

        In lesson 2, we took a look at a repository that already existed. For many people this will be a typical first experience with version control: working with something that someone else started. Eventually though, you will have a need to set up your own repository. In this section you will learn how to create your own local repositories.
      • 00:00:33

      • Converting an Existing Project to Git

        You can start with any folder of files and create a git repository from it, using the command init. By the end of this lesson, you will be able to convert an existing directory of non-versioned files into a Git repository.
      • 00:07:23

      • Connecting to Remote Repositories

        Any folder that has a .git directory can be shared and used for version control. In this lesson you will learn how to connect your local repository to code hosting systems so that you may collaborate with others. You will also learn how to convert a project you downloaded as a zip file into a Git repository.
      • 00:01:24

      • Copying a Repository

        By the end of this lesson, you will be able to make copies of your git repository and describe the limitations of sharing by merely trading a shared repository folder.
      • 00:06:38

      • Cloning a Local Repository

        By the end of this lesson, you will be able to clone a repository to the same file system. This lesson will be most useful for people who want to learn to work with remotes, but are disconnected from code hosting systems such as GitLab or GitHub because they are behind a firewall, or are working offline.
      • 00:04:21

      • Converting a Set of Files to a Repository

        Occasionally, I start a project by downloading a zip package and then realize later that I want to be able to share my work back to the upstream project. By the end of this lesson, you will be able to combine a set of previously locally tracked files to a separate remote repository.
      • 00:10:06

      • Adding Another Remote Connection

        You initially cloned a repository that uses a forking repo. Now you want to publish your results while still maintaining a connection to the upstream project. To accomplish this, you will need to add a second remote to your project. By the end of this lesson, you will be able to add additional remotes to your repository.
      • 00:06:04

      • Working with Branches

        In version control, branches are a way of separating different ideas. They are used in a lot of different ways. You may use branches to denote different versions of software (for example, Drupal has branches for versions 5, 6, 7, 8, and 9, and each of these branches contains significantly different code). You might use very short term branches to work on a new bug fix. You might use a branch to test out a new idea. In this section you will learn how to work with branches.
      • 00:03:32

      • Listing All Branches

        Branches allow us to work on multiple independent thoughts at a time. Your repository will have its own branches. Remote repositories have their own branches. By the end of this lesson, you will be able to list local branches, and remote branches for your repository.
      • 00:05:32

      • Using a Different Branch

        When you checkout a branch, you are updating the visible files on your system ("the working tree") to match the version stored in repository. By the end of this lesson, you will be able to check out a local branch.
      • 00:06:48

      • Establishing Your Branching Strategy

        As you build up your work, you'll add more parallel branches to your work flow. Any work that happens in a branch is completely isolated from other branches in your repository. You can have completely different files for completely different versions of your software. By the end of this lesson, you will be able to identify two common branching strategies and explain under what circumstances they are appropriate development strategies for teams.
      • 00:12:12

      • Creating a Topic Branch

        By the end of this lesson, you will be able to create a new branch using best practices to solve a specific issue identified in your code hosting system.
      • 00:14:35

      • Accepting and Merging New Work

        By the end of this lesson, you will be able to update a local branch using git pull and merge a local development branch using the fast-forward and true merge strategies.
      • 00:06:41

      • Dealing with Merge Conflicts

        Conflicts in Git are inevitable. In this lesson, you will learn how to resolve a merge conflict both at the command line and by using the mergetool, Kaleidoscope.
      • 00:15:23

      • Working with Tags

        Tags are used to pinpoint specific commits. They don't follow a series of commits like a branch does. They are a single point in time along the history of your work. You can think of them like a bookmark on your work.
      • 00:00:53

      • Checking Out Tags

        Once a tag is made, you can investigate just the commit where the tag was added. You can also checkout this tag. You'll go into a DETACHED HEAD STATE! But you'll be fine. By the end of this lesson, you will be able to locate and checkout a specific commit hash by using a tag as the reference point.
      • 00:06:32

      • Recovering from a Detached HEAD State

        In the previous lesson you were left in a detached HEAD state by checking out a tag. By the end of this lesson, you will be able to describe what a detached HEAD state is and be able to recover from it.
      • 00:08:55

      • Sharing Tags

        Tags are only available on your local repository unless you explicitly share them with others. In this lesson, you will learn how to share your tags by pushing them to a remote repository.
      • 00:03:19

      • Finding and Fixing Bugs

        There are two ways to look for bugs: determining where the problem code is, and determining when (and by whom) the problem code was introduced. Although it might be sufficient to debug from the current code in simple code bases, in more complicated projects, it can be useful to have more advanced tools at your disposal.
      • 00:00:52

      • Finding Relative History with Git Log

        In addition to reading through your repository's history in reverse chronological order, you can also ask it for specific commits based on the commit's relationship to another point. In this lesson you will learn how to get a shorter, relative history for your repository using Git log.
      • 00:08:01

      • Finding the Last Working State with Bisect

        Often, it can be difficult to figure out exactly how a bug was introduced in your code. You know something went wrong, but you can't figure out where that extra 2px margin came from. By the end of this lesson, you will be able to use git bisect to find a specific commit when your code changed from working to broken.
      • 00:07:39

      • Finding the Author History of a File with Blame

        Quick command to get a history of who has changed a specific file. This can be helpful when you're working in teams to find the person who might know more about the specific changes that were made to that part of the code base. By the end of this lesson, you will be able to look at the history for a specific file.
      • 00:03:41

      • Using Stash to Work on an Emergency Bug Fix

        If you need to do something “real quick,” but you're in the middle of a complicated set of tasks in your current branch, you can put all of this work on hold with the “stash” command instead of writing a useless commit that you have to unpack later. By the end of this lesson, you will be able to put your work on hold temporarily with git stash.
      • 00:06:37

      • Rollbacks, Resets, and Undoing Your Work

        Oops! You've made a mistake. In this section, you will learn how to change the work you've previously committed in Git using experimental branches and the commands amend, reset, and revert.
      • 00:01:16

      • Using Branches for Experimental Work

        Previously you created and deleted branches using the ticket as a starting point. But what if you were working on a ticket and you weren't sure which of two approaches you should take. In this case, it would be absolutely acceptable to create a branch off of your ticket branch, noodle around some bit, and then merge those changes back into your ticket branch. By the end of this lesson, you will be able to create, use, and delete a new branch.
      • 00:08:30

      • Amending a Commit

        By the end of this lesson, you will be able to amend a commit to add additional changes to your work before sharing it.
      • 00:06:05

      • Removing Changes to the Working Directory

        You're working along and realize you've made a mistake in your working directory that you'd like to undo. Before the changes are locked into place (or "committed") you can "checkout" the files. This will restore the contents of the file to what was stored in the last known commit for the branch you're on. By the end of this lesson, you will be able to restore a file to the state it was in in the most recent commit.
      • 00:06:18

      • Removing Commits with Reset

        When you reset your work, git throws away the commit message, but returns your working directory to the state it was in the moment before the commit was stored. So if you didn't really mean to delete a file in a previous commit, you can reset your working directory. Resets need to be paired with a commit as you are "resetting the working directory". By the end of this lesson, you will be able to restore your working directory to a previously committed state using git reset.
      • 00:08:49

      • Promoting a Previous Commit with Revert

        If there was a commit in the past that was incorrect, you can reverse that single commit. Unlike reset, revert does nothing to the commits in between. It simply puts back the changes you made in the commit you're reverting. Unlike reset, revert applies the changes so you are left with a clean working directory. By the end of this lesson, you will be able to revert previously made changes.
      • 00:05:32

      • Rewiring History with Rebase

        Rebasing is often described as the ultimate Git experience. Although it's not difficult to issue the commands, I have to admit that it makes me a bit uncomfortable. Rebasing isn't about changing the results of your work (although you can if you want to), it's about changing the interpretation of how history happened, without changing the actual outcome you see in your working directory.
      • 00:01:42

      • Bringing Your Work Up-to-Date with Rebase

        One of the most popular "first encounters" for rebasing is when a team decides to adopt a rebasing workflow. In this scenario, you'll use rebase to bring your local branch up-to-date by replaying previous commits that happened upstream as if they had always been there. By the end of this lesson, you will be able to update a branch using rebase to apply commits that have happened in the ancestor branch.
      • 00:10:42

      • Using Rebase to Combine Serveral Commits

        The next most common use for rebase is to take several little commits you've made and squash them into a single commit. This allows you to hide some of your messy work and show only a lovely final solution to your team. This can also be used to simplify a merge / pull request before incorporating it into the main branch for your project (the "trunk"). By the end of this lesson, you will be able to use pick, squash, edit, and reword your commit messages when rebasing your work.
      • 00:07:04

      • Combining Your Changes Into Another Branch with Rebase

        When you merge two branches, you preserve the history of what was once a different branch. You can maintain a single line of work in your log by merging two branches or by using rebase. If you have a specific graph you want to maintain, you need to choose the right method for how you'll combine two sets of work. By the end of this lesson, you will be able to identify when you should use rebase and when you should use merge.
      • 00:10:21

      • Collaborating on GitHub

        GitHub is a popular code hosting system. Unlike GitLab, which we've been using, GitHub is a private company, it is not based on open source software. GitHub can definitely improve your experience with Git, but has several of its own GitHub “isms,” which can make it difficult to know when you're working with Git terms and when you're working with GitHub terms.
      • 00:00:48

      • Forking a Repository

        In this lesson you will learn how to fork a repository on GitHub. This is a review of the GitLab procedure, but for GitHub.
      • 00:01:47

      • Making Changes to Your Fork

        In order to make changes to your forked repository, you will need to make a local clone. In this lesson you will clone a GitHub repository to your local machine.
      • 00:05:08

      • Making Quicker Changes with the Web UI

        You can avoid making a local copy by using the Web UI to make simple changes to your repository. Note: it's harder to maintain good commit message quality through this method, so you'll want to use it carefully.
      • 00:03:39

      • Tracking Your Changes with Issues

        All code that you work on should be identified in a ticket before your work begins. In this lesson you will be introduced to the GitHub ticketing interface.
      • 00:05:00

      • Accepting a Pull Request

        If you want to share your work with others on GitHub, you will need to import a repository. In this lesson you will learn how to copy your GitLab project into a GitHub repository.
      • 00:04:32

      • Importing a Repository - GitHub

        In this lesson you will see how a proposed change to a project can be incorporated into the main project via a Pull Request.
      • 00:04:14

      • Extending GitHub with Hub

        Advanced command line users may want to investigate the project Hub. This toolkit offers a number of features which aren't available through the UI. This is a "tip" lesson and does not include an in-depth exploration of using Hub.
      • 00:02:43

      • Collaborating on BitBucket

        BitBucket is a popular code hosting system by the same folks who built JIRA. Before discovering GitLab, this was my go-to code hosting solution for any work that needed to use private repositories.
      • 00:00:39

      • Making Changes to Your Repository

        If you want to make changes to your fork, you need to clone the work locally and the push the revisions back up to the server. In this lesson you will learn how to work with cloned repositories in BitBucket.
      • 00:05:26

      • Accepting a Pull Request

        In this lesson, you will learn how to complete an incoming pull request to incorporate someone else's work into your project.
      • 00:06:20

Collaborating with Git

  • Publisher: O'Reilly Media
  • Released: November 2014
  • Run time: 6 hours 4 minutes

If you’ve previously tried to learn Git but found the structure of the materials to be opaque, too academic, or just plain confusing, this hands-on video course will help you complete the task. Author and educator Emma Jane Hogbin Westby takes an unconventional approach to teaching version control with Git. Rather than start with the commands you’ll be running, she first explains why—and then demonstrates how.

Along the way, you’ll learn several Git hacks to help you be more efficient. And that means navigating Git from the command line. Many people prefer the “convenience” of a GUI, but in the long run, learning commands is quicker and easier than clicking various buttons on a succession of screens.

  • Create a visual map of Git by sketching your own diagrams
  • Use an example project to get started with hosted Git repositories
  • Learn how to upload changes and merge work with branches
  • Work with tags to pinpoint specific commits in the history of your work
  • Find and fix bugs by comparing “working” and “non-working” states
  • Learn how to undo your work with rollbacks and resets
  • Clean up your commit history with rebase
  • Move your sample project from GitLab to GitHub
  • Learn how to collaborate on GitHub and BitBucket

Emma Jane Hogbin Westby has been working as a web developer since 1996 and has been participating in FOSS communities for over a decade. Having written two Drupal books, including Front End Drupal (Prentice Hall), she has been teaching web-based technologies online and in person for over a decade.