mebioda

Versioning

The problem: how to manage ongoing change

(source: PhD comics)

Part of the solution: work in a project-oriented manner

WS Noble, 2009. A Quick Guide to Organizing Computational Biology Projects. PLoS Computational Biology 5(7): e1000424. doi:10.1371/journal.pcbi.1000424

Backing up and sharing your projects

The distributed approach

git - distributed version control

git workflow - starting a repository

# using HTTPS:
$ git clone https://github.com/<user name>/<project name>.git

# using SSH:
$ git clone git@github.com:<user name>/<project name>.git

git workflow - adding a file

Let’s say I have a file data.tsv that I want to add to a repository:

# I have placed my file in my local repository and check to see if git notices:
$ git status

# response:
On branch master
Your branch is up-to-date with 'origin/master'.
Untracked files:
  (use "git add <file>..." to include in what will be committed)

	data.tsv

Now add it:

$ git add data.tsv
$ git status

# response:
On branch master
Your branch is up-to-date with 'origin/master'.
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

	new file:   data.tsv

So now the file is ready to be “committed”. Let’s commit it to our local repository, and add a message (-m 'message text goes here):

$ git commit -m 'adding file data.tsv' data.tsv

# response:
[master d588593] adding data.tsv
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 doc/week2/w2d3/data.tsv

$ git status

# response:
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
  (use "git push" to publish your local commits)

Now our file has been incorporated in our local repository. If this is a fork of a remote repository we can “push” the file upstream to the remote repo:

$ git push

# response:
Counting objects: 5, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (5/5), done.
Writing objects: 100% (5/5), 455 bytes | 455.00 KiB/s, done.
Total 5 (delta 4), reused 0 (delta 0)
remote: Resolving deltas: 100% (4/4), completed with 4 local objects.
To github.com:naturalis/mebioda.git
   0f031d6..d588593  master -> master

Distributed version control: why?

In addition, GitHub provides for a lot of functionality on top of git: