← Back to Course Overview

Module 1: Git and GitHub

Introduction to Git

During this module, we will introduce a significant tool and resource: Git. Git is essential not only for managing your BloomTech projects but also for enabling collaboration with your future coworkers. Think of it as the 21st-century version of a project conference room, the electronic equivalent of a filing cabinet, and an application that will remain forever open on your computer.

What is Git and GitHub?

Git is a tool used to track code changes and collaborate with others. It allows multiple developers to work on the same codebase without interfering with each other's work, and it creates a history of changes made to files and folders over time. This history can be used to track down bugs, roll back changes, and communicate between developers.

Git serves as a tool to manage multiple versions of source code edit copies. GitHub serves as a location for uploading those edit copies to a repository.

Why Git is Important

You will use Git throughout your career, making it an essential tool to learn and have installed on your machine. We don't expect you to be masters of Git after this lesson, so if you run into issues while using Git to access your code, don't hesitate to contact an instructor for help.

Configuring Your System

After creating your GitHub account, you'll need to configure Git on your local machine. This involves setting up your identity (name and email) and authentication method so Git knows who you are when you make changes.

Key Configuration Steps

  • Setting your name and email in Git
  • Setting up authentication (Personal Access Token)
  • Learning basic command line operations
  • Understanding how to fork repositories

These configurations only need to be done once on your system, and they'll apply to all your Git repositories. The videos below will walk you through each step of the process.

Navigating Git

Now that your system is configured, you'll learn how to use Git to work with code repositories. The core Git workflow involves:

  1. Cloning - Making a copy of a remote repository on your local machine
  2. Making changes - Editing files in your local repository
  3. Staging changes - Using git add to prepare changes for committing
  4. Committing - Creating a snapshot of your changes with git commit
  5. Pushing - Sending your commits to the remote repository with git push

Git Commands Cheat Sheet

  • git clone [url] - Clone a repository
  • git status - Check the status of your changes
  • git add [file] or git add . - Stage changes
  • git commit -m "message" - Commit changes with a message
  • git push - Push changes to remote repository

Git Workflow

Understanding the entire Git workflow is crucial for collaborating effectively with a team. A typical Git workflow includes:

Professional Git Workflow

  1. Fork the main repository to your account
  2. Clone your fork to your local machine
  3. Create a feature branch for your work
  4. Make changes and commit them
  5. Push your branch to your fork
  6. Create a pull request to the main repository
  7. Address feedback and make requested changes
  8. Once approved, your changes will be merged

This workflow ensures changes are reviewed and tested before being integrated into the main codebase, reducing the risk of bugs and conflicts.

Guided Project

In this guided project, you'll practice the Git skills you've learned by working with a real repository. You'll go through the complete workflow of forking, cloning, making changes, committing, and pushing your work.

Project Goals

  • Practice initializing a Git repository
  • Create and make changes to files
  • Stage and commit changes with meaningful commit messages
  • Push changes to GitHub
  • Learn to resolve basic conflicts

Follow along with the video to complete the guided project successfully. Remember, practice is essential for mastering Git workflows!

Additional Resources

Documentation

Practice Resources

Common Git Commands