#!/usr/bin/env python # coding: utf-8 # # Introduction to git and github # # # # Version Control Software # # * tracks current state and all past versions of # * code # * papers # * websites # * especially useful for collaborative projects # # git and [github.com](https://github.com) # * git is popular VC system # * [github.com](https://github.com) hosts the projects version controlled with git # * github is facebook for coding # # # Today # # * Basic git / github usage # * setting up a github account # * git clone, add, pull, push # * .gitignore # * Class Uses # * 689 Homework: backs up files, good advertising for your career # * Course Project: easily share code and reports with partner # Drawing # # Terminology # # * **repository (or repo)**: a project storing code or other files # * **collaborators**: set of individuals who can modify repo # * **public repository**: repo which anyone case see # * **private repository**: repo that only collaborators can see # # * [github.com](https://github.com) has lots of public repositories that you can browse # # Setting up Git # # 1. Download git software for your system, [instructions here](https://gist.github.com/derhuerst/1b15ff4652a867391f03) # 2. Create an account at [github.com](https://github.com) # * Unlimited public repos are free # * $7 / month for unlimited private repos # * student membership for free private repos at [https://education.github.com/](https://education.github.com/) # # Demo 1: Creating a git repo for class homeworks # # * common git commands # * git clone # * git status # * git add # * git commit # * git pull # * git push # * pushing and pulling requires authentication unless you [set up ssh](https://help.github.com/articles/connecting-to-github-with-ssh/) # # Demo 2: Collaborating on class project using git # # * adding collaborators # * resolving conflicts # * git is not good for: # * large data files # * compiled files e.g. pdfs compiled from .tex # * use .gitignore to avoid version controlling compiled files # * create a script to download data files available on the internet # # # Demo 3: Project Website # # * The course website [https://longjp.github.io/statcomp/](https://longjp.github.io/statcomp/) is a github repo. # * make changes on local copy of repo # * push changes to github # # Resources # # * [https://help.github.com/](https://help.github.com/) # * [Tutorial for Beginners](https://product.hubspot.com/blog/git-and-github-tutorial-for-beginners) # # [github.tamu.edu](https://github.tamu.edu/) or [github.com](https://github.com) # # * github.com # * visible to world # * public repositories free # * pay for private repositories # # * github.tamu.edu # * requires NetID to view and collaborate on projects # * nearly unlimited private and public repositories # # * see [here](https://github.tamu.edu/pages/tamugithub/changelog/) for a good description