In this lesson we'll learn about version control,
a process for tracking changes to files on a computer.
We'll use Git,
a free and open source distributed version control system,
and GitHub,
a company that provides hosting for software development and version control
built on git
.
Learning objectives:
- Understand version control concepts
- Configure Git and GitHub on a computer
- Understand basic
git
commands - Get exposure to some intermediate/advanced
git
commands - Know where to get help, or more information
Fundamentally, version control is for tracking changes to files. But this leads to much more. Here are some examples...
- Back up your thesis -- Did you ever accidentally delete a thesis chapter? With version control, you can recover it!
- Save code -- whether it's a class assignment or a journal article figure, you never know when you might need it again.
- Get organized -- Keeping versions of programs (e.g., flux1.py, flux2.py, flux2a.py, flux2a-1.py, etc.) lying around can be confusing. Version control provides tools for structuring these versions.
- Explore without fear -- Version control can give you confidence to try new things, knowing that if you mess something up, you can always go back to a safe point.
- Share code -- A public repository can be searched and discovered by anyone, augmenting open science.
- Collaborate -- Work with other scientists on a research project, or on writing a proposal or paper.
- Time machine -- When your team uses version control, as team members move on, their work doesn't.
This lesson on version control continues in the following sections.
- The full Git documentation
- The full GitHub documentation
- In the GitHub documentation:
- A git command cheatsheet from GitHub
- A (great) BSSw blog post: A Different Way of Looking at Git
- The Basics of Git and GitHub from CoMSES Net
- Top 12 Git commands every developer must know from the GitHub blog
- Software Carpentry lesson on version control