URPP Tutorials

URPP Evolution in Action

URPP logo

Stefan Wyder & Heidi Tschanz-Lischer

Introduction to git

The tutorial is heavily based on a Software Carpentry Course

  1. Introduction
  2. Setting Up Git
  3. Creating a Repository
  4. Tracking Changes
  5. Exploring History
  6. Ignoring Things
  7. Remotes in GitHub
  8. Collaborating
  9. Conflicts
  10. Open Science
  11. Licensing
  12. Hosting

Chapters 1-6 by Stefan (Intro Presentation)
Chapters 7-12 by Heidi (PDF Presentation | PDF Exercises)

Course Summary with Glossary

Additional topics (Stefan)

  1. Non-code files (Images, PDFs, Office documents)
  2. Large files Link1 | Link2 | Video (2min)
  3. Documentation/Website hosting
  4. Commit best practices

Installing git on the command line

In my opinion it is easier to learn git using the command line. After initial setup all we need for our daily work are 3 or 4 git commands - with time we learn and memorize more commands. By using graphical interfaces there is a higher risk of using advanced commands without really knowing what they do.

  • Mac
    Install Git from here: http://git-scm.com/downloads.
    For older versions of OS X (10.5-10.7) use the most recent available installer available here.
  • Windows
    Install Git for Windows by downloading and running the installer. This will provide you with both Git and Bash in the Git Bash program.
  • Linux
    You can install it via your distribution's package manager. For Ubuntu run sudo apt-get install git.

Installing Graphical Interfaces

We recommend SourceTree (Mac, Windows), Github for Mac and, for Linux, GitKraken or SmartGit.

RStudio also comprises a basic git client.

Because all of the clients are just forming and executing Git commands on your behalf, you don’t have to pick one.
You can literally do one operation from the command line, do another from RStudio, and another from SourceTree, one after the other, and it just works.

For a full list of available graphical interfaces, see http://git-scm.com/downloads/guis

Installation problems

In case of installation problems, consult this site and this site.

Setting up git

Configure git the first time is used on a computer.

Tell Git your name so your commits will be properly labeled

git config --global user.name "YOUR NAME"

Tell Git the email address that will be associated with your Git commits.

git config --global user.email "YOUR EMAIL ADDRESS"

set-up help | other link

Getting help

Links

Cheatsheets

Courses

Improving git skills

How to undo (almost) anything with Git

Markdown

Tips

  • Graphical diff/merge software, e.g. DiffMerge
  • Github gives educational discounts to students, teachers, administrators, and researchers. Apply at https://education.github.com
  • Git/GitHub in data analysis using R - nice practical paper
  • Git in science
  • Use GitHub safely without entering a password at each visit - generate SSH key and add to GitHub. Setup via command line or via SourceTree/Gitkraken