Automated Version Control


  • Version control is like an unlimited ‘undo’.
  • Version control also allows many people to work in parallel.

Setting Up Git


  • Use git config to configure a user name, email address, editor, and other preferences once per machine.

Creating a Repository


  • git init initializes a repository.

Tracking Changes


  • git status shows the status of a repository.
  • Files can be stored in a project’s working directory (which users see), the staging area (where the next commit is being built up) and the local repository (where commits are permanently recorded).
  • git add puts files in the staging area.
  • git commit saves the staged content as a new commit in the local repository.
  • Always write a log message when committing changes.

Exploring History


  • git diff displays differences between commits.
  • git checkout recovers old versions of files.

Ignoring Things


  • The .gitignore file tells Git what files to ignore.

Branches


  • Branches can be useful for developing while keeping the main line static.

Conflicts


  • Conflicts occur when files are changed in the same place in two commits that are being merged.
  • The version control system does not allow one to overwrite changes blindly during a merge, but highlights conflicts so that they can be resolved.

Remotes in GitHub


  • A local Git repository can be connected to one or more remote repositories.
  • git push copies changes from a local repository to a remote repository.
  • git pull copies changes from a remote repository to a local repository.

Pull Requests


  • Pull requests suggest changes to repos where you don’t have privileges

Open Science


  • Open scientific work is more useful and more highly cited than closed.

Licensing


  • People who incorporate General Public License (GPL’d) software into their own software must make their software also open under the GPL license; most other open licenses do not require this.
  • The Creative Commons family of licenses allow people to mix and match requirements and restrictions on attribution, creation of derivative works, further sharing, and commercialization.
  • People who are not lawyers should not try to write licenses from scratch.

Citation


  • Add a CITATION file to a repository to explain how you want your work cited.

Hosting


  • Projects can be hosted on university servers, on personal domains, or on public forges.
  • Rules regarding intellectual property and storage of sensitive information apply no matter where code and data are hosted.

Using Git from RStudio


  • Create an RStudio project