Skip to content

Instantly share code, notes, and snippets.

@HenrikBengtsson
Last active January 10, 2017 15:34
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 HenrikBengtsson/663f1a79b48a993024bd421ebe7cdeb6 to your computer and use it in GitHub Desktop.
Save HenrikBengtsson/663f1a79b48a993024bd421ebe7cdeb6 to your computer and use it in GitHub Desktop.
WORK FLOW: Git and Bioconductor SVN (2016)

WORK FLOW: Git and Bioconductor SVN (2016)

This is how I currently work with Git and the Bioconductor SVN. I'll use the affxparser package as an example.

Clone existing Git repository

% git clone git@github.com:HenrikBengtsson/affxparser.git
% cd affxparser

Checkout existing Git Flow branches

I'm using the Git Flow workflow everywhere, including this package. In short, the master branch reflects the most recent official release. In case of Bioconductor packages, this corresponds to the most recent Bioc devel version. One philosophy behind Git Flow is that commits should never be done to the master branch; it should only receive merges from other branches. Any incremental development is typically done to the develop branch (note that this is not the same as the Bioc devel version; hence the renaming of devel -> bioc-svn/devel below). Another concept of Git Flow is "feature" branches, which are branches one can uses for more long-term or larger additions that are to complex/risky to do directly to the develop branch. If successful, feature branches will later be merged into develop and then be closed/removed. If discontinued, they can be dropped without having to do any unrolling of commits.

% git checkout develop
% git checkout master
% git branch
  develop
* master

Setup Git SVN

From https://www.bioconductor.org/developers/how-to/git-mirrors/:

% curl -O https://raw.githubusercontent.com/Bioconductor/mirror/master/update_remotes.sh
% bash update_remotes.sh

Then I rename the locally created branches such that their names reflect they are associated with the Bioconductor SVN branches (see also Bioconductor/mirror#10). This also makes it less confusing when there is also the Git Flow develop branch.

% git branch -m devel bioc/devel
% git branch -m release-3.0 bioc-svn/release-3.0
% git branch -m release-3.1 bioc-svn/release-3.1
% git branch -m release-3.2 bioc-svn/release-3.2
% git branch
  bioc-svn/devel
  bioc-svn/release-3.0
  bioc-svn/release-3.1
  bioc-svn/release-3.2
  develop
* master

For now, I choose not to push these bioc-svn/* branches to GitHub.

Pulling down updates available on the Bioconductor SVN server

From https://www.bioconductor.org/developers/how-to/git-mirrors/:

% git checkout bioc-svn/devel
% git pull
% git svn rebase

Then merge this into the master branch (such that the master branch reflects the Bioc devel version):

% git checkout master
% git merge --ff-only bioc-svn/devel

If fast-forward merging is not possible, e.g.

% git merge --ff-only bioc-svn/devel
fatal: Not possible to fast-forward, aborting.

we need to cherry-pick the updates, e.g.

% git cherry-pick bioc-svn/devel
[master c371392] version bump
 Author: khansen <khansen@bc3139a8-67e5-0310-9ffc-ced21a209358>
 2 files changed, 4 insertions(+), 1 deletion(-)

When we know that the master is in sync with bioc-svn/devel:

% git diff master bioc-svn/devel
[ empty line]

we can push master to GitHub:

% git push
Counting objects: 29, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 501 bytes | 0 bytes/s, done.
Total 4 (delta 3), reused 0 (delta 0)
To git@github.com:HenrikBengtsson/affxparser.git
  95395ed..c371392  master -> master

As typical last step in bringing in updates from the Bioconductor SVN server is to merge the updates into the develop branch;

% git checkout develop
Switched to branch 'develop'
Your branch is up-to-date with 'origin/develop'.

% git merge master
Updating d1b0f06..c371392
Fast-forward
 DESCRIPTION  |  2 +-
 NEWS         |  3 +++
 README.md    | 11 -----------
 appveyor.yml |  3 ++-
 4 files changed, 6 insertions(+), 13 deletions(-)

If needed, I bump the version of the develop branch to have a version x.y.z-9000 and commit and push:

% git commit DESCRIPTION -m "Bump develop version"
[develop 57991b5] Bump develop version
1 file changed, 1 insertion(+), 1 deletion(-)

% git push
Counting objects: 21, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 296 bytes | 0 bytes/s, done.
Total 3 (delta 2), reused 0 (delta 0)
To git@github.com:HenrikBengtsson/affxparser.git
  d1b0f06..57991b5  develop -> develop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment