Skip to content

Instantly share code, notes, and snippets.

@hofnerb
Last active September 30, 2019 10:53
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hofnerb/7dfca4ad492a50e31a3e to your computer and use it in GitHub Desktop.
Save hofnerb/7dfca4ad492a50e31a3e to your computer and use it in GitHub Desktop.
Git with R-forge

Git with R-forge

In the following example we will use the package gamboostLSS. Replace this were necessary.

First "download" (clone) existing r-forge repository

mkdir gamboostLSS
cd gamboostLSS
git svn clone svn+ssh://hofner@svn.r-forge.r-project.org/svnroot/gamboostlss .

Check that .git/config has the following entry:

[svn-remote "rforge"]
  url = path/or/url/to/svn/repository
  fetch = :refs/remotes/r-forge-svn

Rename the master branch:

git branch -m rforge-local

Now create a branch that is supposed to be linked to github:

git checkout -b master

Now create a new repository (here gamboostLSS) on github and push the local branch to this repository:

git remote add origin git@github.com:hofnerb/gamboostLSS.git
git push -u origin master

Now one can rename the local github branch (if desired).

Merging between r-forge and github branches

If one has commited one or more changes to the github branch master, one needs to merge this branch with the r-forge branch rforge-local. To do so, one uses

git checkout rforge-local
git merge --squash master
git commit -m "some dummy text"
git commit --amend

The last two lines are only neccessary to get an (almost) empty commit message. Usually, the commit message after a squashmerge is overly rich and lengthy. If the desired commit message is short anyway one can skip the last step and type this message directly instead of "some dummy text".

To finalize the commit, one needs to rebase and dcommit the local r-forge branch:

git svn rebase
git svn dcommit

Source: http://cameron.bracken.bz/git-with-r-forge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment