-
Notifications
You must be signed in to change notification settings - Fork 34
Using git
Our code is available on a public git repository. For the most part we follow a shared repository model, with https://github.com/VertebrateResequencing being the primary distribution point. We use git flow.
Read these if you're new to git or git flow:
- http://help.github.com/
- http://git.or.cz/course/svn.html
- http://nvie.com/posts/a-successful-git-branching-model/
- http://jeffkreeftmeijer.com/2010/why-arent-you-using-git-flow/
- http://github.com/nvie/gitflow
Here's a brief guide on the essentials:
Initially you need to configure git. This is only done once.
git config --global user.name "Your Name"
git config --global user.email "your.name@domain.com"
if you don't already have .ssh/ keys (http://help.github.com/mac-key-setup/):
cd ~/.ssh
ssh-keygen -t rsa -C "your.name@domain.com"
now you have a key:
id_rsa.pub copied to your personal github account
git config --global github.user your_github_username
git config --global github.token from_your_github_account_page
git config --global core.editor nano
you may also need to configure the proxy settings:
git config --global http.proxy http://yourproxy.com:9999
external user forks the repo and clone from their own fork. They can also pull in changes from the original by setting the upstream:
http://help.github.com/forking/ click the fork button on https://github.com/VertebrateResequencing/vr-codebase
git clone git@github.com:external_user/vr-codebase.git
git remote add upstream git://github.com/VertebrateResequencing/vr-codebase.git
git fetch upstream
you need to be inside the resulting directory for all subsequent commands to work:
cd vr-codebase
initially you might be on the master or develop branch; you'll only see one of them without -a option:
git branch -a
setup tracking branches to both, leaving yourself on the develop branch:
git checkout -b master remotes/origin/master
or git checkout master
git checkout -b develop remotes/origin/develop
or git checkout develop
you also need to setup up git flow:
git flow init
(answer defaults to every question)
be on develop branch (default):
git checkout develop
(modify or add files)
(run test suite)
git add .
git status
and/or git diff --cached
git commit -m '...'
git pull upstream develop
dealing with conflicts: http://book.git-scm.com/3_basic_branching_and_merging.html
list feature branches:
git flow feature
create a new feature branch:
git flow feature start feature_name
(modify, add, commit)
in the middle of working on one branch, you may want to switch to another:
git commit
or git stash
git checkout develop
(...)
git checkout feature/feature_name
(git stash apply)
merge back to develop and delete the feature branch, perhaps after using pull request to instigate code review and discussion:
git flow feature finish feature_name
upload to github:
git push origin develop
The short version: just ignore this subdirectory.
The 'bin' subdirectory of vr-codebase is actually a submodule - an independent repository only available to those working at the Sanger. It contains all the external software needed by our pipelines.
Do not try and do "git submodule init" or "git submodule update"; it won't work if you're external to Sanger.