Notes on my R / Git workflow

March 10, 2013

(This article was first published on Computing / Geek, and kindly contributed to R-bloggers)

These are some notes on my current R git work flow, which is quite fluid, and git has enough quirks that I usually forget part of it !

Creating Projects

I’ve used both RStudio and Eclipse.  RStudio seems easier to create a ‘project’ and add a local git repo to it, but Eclipse has more functionality (like roxygen comment generation) so I prefer eclipse. 

In Eclipse 3.7, I have both Statet and eGit installed. To start create a new project normally (File > New > R Project), and add any starting stuff like R and Data folder, a readme etc…

Right click on the project name and select Team > Share Project.  Select Git and then create a local Git Repo.  For some reason eclipse has a check box to create the repo within the Eclipse workspace, and then gives you a warning that its not recommended.

Then there are a few ways to commit, Right click on project and Team > Commit, use the Git Staging view tab,   Whatever route, select which files to commit and enter a comment.  Your name and email is stored in Preferences > Team > eGit.

Backing Up ‘locally’

To ‘backup’ (and potentially make available anywhere) I have a Linux server called Pegasus  tucked away somewhere that does many, many jobs.  it’s actually an old work desktop and a tad underpowered, but it does the job.

One job is to act as a backup server, and that goes for git too.  using two pieces fo software, Gitosis and gitview. (although it seems Gitosis hasn’t been updated in a few years, and isn’t being actively maintained, which means no new bugs !)

To add a new repo to my server
on local machine;

kate gitosis.conf

add lines for the new repo, save and close

git commit -a -m "add repos for xxx"

Then cd to the repo your adding

git remote add pegasus [email protected]:PaulHurleyMisc.git

git push pegasus master

and the repo is magically on the server.  I can even visit http://pegasus/viewgit/index.php and see the new repo sitting there.

 Backing up to the cloud AKA Github

For things I’m happy to share, I have used github as a great cloud based way to share code (  The thing that always gets me is the need to create the repo on github before pushing to it.

So create a repo on Github

then, on your local machine
git remote add github

git push github master

and I then get an error that something conflicts (because I have a file with the same name in both, usually, so need to do

git pull

and then merge/drop any changes before doing git push again….


Some assorted Links


To leave a comment for the author, please follow the link and comment on their blog: Computing / Geek. offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Search R-bloggers


Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)