We’ve already gone over markdown and RStudio in class. You can download RStudio at RStudio homepage. You can learn more about markdown at Markdown Help via RStudio.

Git and Bitbucket

Git is used for version control. Bitbucket is a free, private repository for using version control and sharing code, files, etc. (Github does the same thing). You can download bitbucket at Bitbucket homepage.

  1. First download git.
  1. Create a new repository (repo).

create a new directory, open it and perform

git init

to create a new repo.

  1. checkout a repo

create a working copy of a local repository by running the command

git clone /path/to/repository

when using a remote server, your command will be

git clone username@host:/path/to/repository

  1. workflow: your _local _repo has three “trees” maintained by git. The first is the Working Directory, which holds the actual files. The second one is the Index which acts as a staging area and finally the Head, which points to the last commit you made.

picture of work_flow

  1. add and commit

You can propose changes (add it to the Index) using

git add <fileName>

This is the first step of the basic git workflow. To commit these changes (to the master directory) use

git commit -m "Commit <add helpful message>.

Now the file is committed to the HEAD but not in your remote repository yet.

  1. pushing changes

Your changes are now in the HEAD of your local working copy. To send those changes to your remote repository, execute

git push origin master

Note: Change master to whatever branch you want to push your changes to. Now you are able to push your changes to the selected remote server (bitbucket for example.)

  1. branching

Branches are used to develop features isolated from each other. The master branch is the “default” branch when you create a repository. Use other branches for development and merge them back to the master branch upon completion.