Introduction to Git

This tutorial will guide you through understanding and setting up Git, a system for distributed version control.

 

What is Git?

Introduction to a Code Repository

Git is a system for keeping track of the current state and history of a software repository, and is typically usually used for the collaborative development of software.

 

Git vs. GitHub

  • Git is a version control system that keeps track of your repository
  • GitHub is an online web interface for Git that can host source code
 
Terms and Nomenclature
  • Stage/Add: After you make changes in your local repository, add files to update your the state of your repository with the changes you just made
  • Commit: When you commit, the files you just added are committed to the repository as a group
  • Fetch: Remote Store -> Local; bring in any new updates from teammates
  • Merge: Bring the previous state of the remote repository (in GitHub) up-to-date with your local repository
    • If multiple people are committing to the same repository, sometimes merges result in merge conflicts. When this occurs, you will need to manually fix merge conflicts (conflicts will be marked in the files with conflicts). Once fixed, add and commit.
  • Pull: pull combines fetch and merge, but using the commands separately may help you avoid problems
  • Push: Local Store -> Remote; push your local changes to the remote repository
Distributed Version Control
  • The way teams use git is distributed, meaning each person has their own repository
  • Individual team members’ repositories must be brought into sync
  • The basic git commands for distributed version control are fetch, merge, and push
  • An overview of distributed version control:
    • Commit locally
    • Fetch/merge (or pull) as appropriate
    • Push to share
Continue to the next page on Setting up and cloning your repository:

https://u.osu.edu/fehproteus/setting-up-and-cloning-a-git-repository/