git good: intro to source control

Posted

The Git logo

I am holding a short tutorial at .Astronomy 8 on the topic of source (version) control. Here's what you need to get up to speed.

Setup and presentation files

  • You will need git on your machine:
    • Linux users might have it already or can install through their package manager (for example, sudo apt-get install git).
    • Mac users might have it already, might be able to install it automatically by typing git into Terminal, or can get it from http://git-scm.com/download/mac.
    • Windows users should really consider getting a better command line, and cmder is a good option: get the full package for access to all Unix commands and git. Or go to http://git-scm.com/download/windows to do your own setup.
  • The presentation is an HTML slideshow. You can follow along here or go back if you missed anything. It responds to swipes on touchscreen devices, which is cool—but I make no guarantees that it will work properly on your device!
  • There is also a sample repository for the last couple of exercises.

Points and questions raised by the audience

  • Github does free private repositories for academic use. If you don't have an academic affiliation, you can sign up for another service like Bitbucket (which provides free private repositories).
  • There is a difference between the source control tool itself (git, in this case) and the online hosting provided by services like GitHub. The first, git, is a tool that tracks your software and documents. It lets you create commits, move back and forward through the source history, create branches to try out new things, and push and pull from other repositories. However, it does not automatically back up your work, and you still need to take backups as usual to protect yourself from data loss. Only once you have pushed your work to an online hosting provider like GitHub is it really "safe".