GIT AND GITHUB WORKSHOP Lab Meeting March 16
GIT AND GITHUB WORKSHOP Lab Meeting March 16, 2017 David Tavernini
Introduction Outline Rationale: • Smooth workflow • Prevents headaches • Becoming more prevalent • Computers shouldn’t be intimidating Outline: 1. Introduction to VC 2. Local git* 3. git in R* 4. Using git remotely* 5. Perks of Git. Hub*
Introduction Problem: • Numerous file edits • Uncertainty in edits you make • Need to log changes (collaborative environment) Solution: • Maintain accessibility of certain editing milestones • Track changes, when they were made, and who by
Version Control
git locally What is git? • Version control system • Keeps a log of noted changes in repository • Repository “repo”: Directory where git operates • Saves snapshots of repo when user makes a “commit” • Branching • Analogy: filing cabinet
git locally TIME
git locally git demonstration • Context: • Have an empty directory for your project workspace • Setup directory for git • Add files, make changes, commit • Branch off and make changes
git locally git demonstration • Context: • Have an empty directory for your project workspace • Setup directory for git • Add files and make changes • Branch off to make changes Obligatory disclaimer: working in console CAN cause damage if you don’t know what you are doing.
git in R git with R • Project directories • Allows a directory to be specified as project • Sets working directory to be within project • Integrating with git • R provides basic graphical user interface (GUI) • Many limitations, good for basic use
git in R git + R Demonstration • Context: • You need to setup a directory for R work • Initialize R project with Git • Create scripts • Make commits • Branching
Git. Hub What is Git. Hub? • Free online service to act as a remote repo • Users make changes, commit to local repo, and push to Git. Hub • When multiple machines are used, you can push and pull • Analogy: common filing cabinet
Git. Hub Advantages • Works well in collaborative environment: • Tracks changes from multiple authors • Good documentation of changes • Works especially well with text/Markdown documents • Optionally allows open access • Others can clone your repo and make improvements • E. g. create a model script for others to use/develop
Git. Hub Integrating git, Github and RStudio • Context: • • • Creating a project shared among others Open a repo in Git. Hub Begin project in R Clone to local computer Make changes and commit Obligatory disclaimer: refrain from putting any (current or future) sensitive information on github.
Optional: Fork/Pull request • Fork off other repos within github • Make changes and make pull request • Experimental exercise
Questions?
- Slides: 15