Project

General

Profile

Development cycle » History » Revision 5

Revision 4 (Tom Clegg, 08/12/2011 03:01 PM) → Revision 5/14 (Tom Clegg, 08/12/2011 08:41 PM)

h1. Development cycle 

 h2. Getting the code base 

  git clone git@git.clinicalfuture.com:pgp-enroll.git 

 h2. Writing and contributing code 

 Start a branch like username/master or username/rails3 

  git branch example/rails3 
 git checkout example/rails3 

 Do something trivial like 

 * add app/views/pages/specimen_collection.html.erb 
 * add link to it in app/views/pages/home.html.erb 

 Commit it.    If you refer to the issue# in the comment, redmine will notice this and do smart things (e.g., link to the commit from the issue page). 

  git add ... 
 git commit -m 'description of stuff (closes #123)' 

 Push it 

  git push 

 Generate a pull request 

  git request-pull e68ab19^ git@git.clinicalfuture.com:pgp-enroll.git e68ab19 

 Send the pull request to someone like Ward 

 h2. Merging code from other contributors/branches 

 Fetch latest code in other developers branches 

  git fetch 

 List remote branches 

  git branch -a 

 Switch to the other branch 

  git checkout origin/example/rails3 

 (git will complain about being in a detached head state, but that's fine - just don't commit to this state) 

 Now look around, test 

  git log 

 Switch to production branch (set up with @git checkout --track origin/rails3@ if you haven't already) and make sure it's up-to-date 

  git checkout rails3 
 git pull origin rails3 

 See what hasn't been merged 

  git cherry -v rails3 origin/example/rails3 

 Cherry-pick a commit 

  git cherry-pick e68ab19 

 Or merge the entire remote tree (this will fetch and merge but not yet commit) 

  git merge --no-commit origin/tomc/rails3 
 
 When you're happy,  

  git commit 

 Or rewind 

  git reset --hard rails3 

 Finally, push 

  git push 

 h2. Deploying to my-dev 

 Make sure "ssh www-dev.sum" puts you in root@www-dev and includes agent forwarding. 

 tomcHost www-dev.sum 
   HostName www-dev 
   User root 
   ForwardAgent yes 
   ExitOnForwardFailure yes