Introduction to Git and GitHub

Transparent Programming: Important Habits for Reproducibility and Research Integrity

Git Introduction

Git (/ɡɪt/) is a version control system (VCS) for tracking changes in computer files and coordinating work on those files among multiple people. It is primarily used for source code management in software development, but it can be used to keep track of changes in any set of files. As a distributed revision control system it is aimed at speed, data integrity, and support for distributed, non-linear workflows. -Wikipedia

Git is an open source program for tracking changes in text files. -github GitHub Glossary

What is Git?

Keeping track of file versions is hard.

So how does it help us?

Git is a fast and distributed version control system.

  • Reverting to past save points (commits)

  • Keeping track of save points (commit messages)

So how does it help us?

  • Comparing changes to past save points (diff)

  • Non-linear workflow (branches)

  • Fearlessness in making changes

Git versus GitHub

  • Git: A distributed version control system.

Git versus GitHub

  • GitHub: A social coding platform.

Git versus GitHub

  • Git ≠ GitHub

Learn More

Some Vocabulary

Basics:

  • Git: Version control software

  • Repository: Folder with files & structure for tracking changes

  • Commit: Set of changes to a file

Collaboration:

  • GitHub: Host for git repositories & collaboration

  • Local Repository: Version of a git repo on your computer

  • Remote Repository: Version of a git repo stored elsewhere

GitHub Introduction

GitHub is for:

  1. Storing and viewing Git repositories

  2. Collaborating within an organization

  3. Open Source Collaboration

  4. Web Hosting

And more…

Let’s Dive In!

Vocabulary:

  • Local repository: A folder on your computer

  • Remote repository: A folder on GitHub

Example Repository

GitHub’s Features

  • The README.md file
  • Commit Log
  • History, Raw, and Blame for files
  • Branches, Pull Requests, Proposing Edits, Drag & Drop, Collaboration
  • Serving Websites with GitHub Pages

GitHub Beyond Code

  • Auditing system for file changes
  • Collaborative text document editing
  • Design, Open journalism, Government use, and more…

Using Git Locally

Learn Git locally via the command line.

Vocabulary

  • Git: Version control software
  • Repository: Folder with files & structure for tracking changes
  • GitHub: Host for git repositories & collaboration
  • Local Repository: Version of a git repo on your computer
  • Remote Repository: Version of a git repo stored elsewhere
  • Commit: Set of changes to a file

Components of a Git Repository

  1. Working directory
  2. Staging area
  3. Commit

Pushing to GitHub

Key Terms: - GitHub: Hosts git remote repositories - Remote: Another repository for synchronization - Clone: Download a remote repository for local use

Example: simple-rscript

Clone, edit, commit, and push changes.

Example Repository