git/github guide a minimal tutorial
All statistical/computational scientists should use git and github, but it can be hard to get started. I hope these pages help. (More blather below.)
There are many resources for git and github; my aim is to provide the minimal guide to get started.
- Why git and github?
- Your first time: get github account; install git, set up ssh.
- Typical use: add, commit, push, status, and diff.
- Start a new repository: from scratch, or with an existing project.
- Contribute to someone’s repository: fork.
- Handling merge conflicts.
- Oops; that last commit message was wrong.
- Exploring the code and its history: tag, diff
- Branching and merging.
- Delete a repository.
- Git/github with RStudio
- Other (much more thorough) resources.
I love git and github. I use both for keeping track of programming projects, papers, talks, and data analyses. And github has enabled me to contribute at least minor things to others’ projects, like the D phobos library and d3-tip.
I use git mostly from the command line on a Mac. I use the github site to explore others’ code, to indicate issues in their code, and suggest changes to their code.
I would like all of my statistical/computational collaborators to use git and github, so that we may collaborate more easily. But for statisticians with no history of use of version control, it can be hard to get started. This is a tutorial of sorts, to help.
Saunak Sen got me started with version control (using subversion), and Pjotr Prins got me to move from subversion to git, but don’t hold either responsible for any errors in my understanding.
If you have suggestions for changes or improvements, submit an issue or fork the repo: Follow the instructions above, “Contribute to someone’s repository.”
Also see my tutorials on GNU make, knitr, R packages, making a web site with GitHub Pages, data organization, and reproducible research.