What is Git?

  • A version control system.
  • Its original purpose was to help groups of developers work collaboratively on big software projects.
  • Git manages the evolution of a set of files – called a repository – in a sane, highly structured way.

What is Git?

GitHub Account

  • First, register a GitHub account.
  • Please choose a username that you would feel comfortable showing it to your boss later!
    • coolcoder, freakingawesome, etc. are probably not good ideas.
    • use your real names (so people can recognize you)
  • Sign up for GitHub Education
    • Free pro plan after verificating student’s status

Let’s Get Started!

Let’s Get Started!

  • Now, introduce yourself to Git
    • if you’re using the command line terminal or through a client (RStudio), you have to enter the following commands in the terminal.
git config --global user.name 'Jane Doe'
git config --global user.email 'jane@example.com'
git config --global --list

Connect to GitHub

  • Create a repo on GitHub
  • Clone the repo to your local computer
  • Make a local change, commit, push
  • Confirm the change on GitHub remote repo

Git Basics

Three States in Git

  • Git has three main states that your files can reside in:
    • modified
    • staged
    • committed

Three States in Git

  • Modified means that you have changed the file but have not committed it to your database yet.
  • Staged means that you have marked a modified file in its current version to go into your next commit snapshot.
  • Committed means that the data is safely stored in your local database.

Three Main Sections of a Git Project

  • This leads us to the three main sections of a Git project:
    • the working tree/directory
    • the staging area
    • the Git directory (repository)

Basic Git Workflow

  • The basic Git workflow goes something like this:
    • You modify files in your working tree.
    • You selectively stage just those changes you want to be part of your next commit, which adds only those changes to the staging area.
    • You do a commit, which takes the files as they are in the staging area and stores that snapshot permanently to your Git directory.
    • When you’re ready to update the remote repo, push the commit(s).