Managing research projects with Git

2 minute read

Published:

Recently, Vuorre and Curley (in press) published a paper/tutorial, [Curating Research Assets: A Tutorial on the Git Version Control System link] (http://journals.sagepub.com/doi/full/10.1177/2515245918754826),  explaining how to use Git, a version control system, to manage and control research assets. I applied it to manage one of my final projects, and I like it so much that I am using git to manage all projects. However, rather than R studio as suggested by authors, I have been using git in the command line. Also, I have used the Dropbox as a remote repository so I can work on multiple computers, using only half of Dropbox storage space. To set up the Dropbox as a remote repository, I followed the tutorial available on [Random Stuff link] (https://blog.shvetsov.com/2013/04/using-git-with-dropbox.html). Below, I show the steps described on the blog. First, open the command line and move to the folder that you want to track and control the changes. Then, type:

#1 - creating a git repository
git init # start tracking the folder
git add . # add all changes
git commit # commit the change[/code]

Now, to set up the Dropbox as a remote repository, you will need to type:

#2 - creating a remote repository on Dropbox
git init --bare ~/Dropbox/papers/new-project.git # start our remote repository folder
git remote add dropbox ~/Dropbox/papers/new-project.git # make the Dropbox folder the "online" repository
git push -u dropbox master # push the local folder version to "online" repository
git push # update the remote repository

In doing so, when you will work on a new computer that does not have a local repository, you type:

#3 - Retrieving the remote repository for the first time
git clone -o dropbox ~/Dropbox/papers/new-project.git # clone the remote repository if you don’t have a folder

Already have the local repository? then you only need to type inside of the proper folder

#4 - updating a local repository
git pull # check and download updates of remote depository

Now, you have a private online remote repository.

As you keep using git, you will memorize that commands in (1) promote changes and in (2) retrieve changes.

#1
git add .
git commit
git push
#2
git clone
git pull

For a detailed explanation of how git works, I recommend reading of Vuorre and Curley (in press).