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 !
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;
cd~/gitosis-admin 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 gitosis@pegasus: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 (https://github.com/paulhurleyuk). 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 https://www.github.com/paulhurleyuk/testrepo.git
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 readme.md), so need to do
and then merge/drop any changes before doing git push again….
Some assorted Links