Project

General

Profile

RedmineGitTracking » History » Revision 2

Revision 1 (John Goerzen, 2008-03-07 23:27) → Revision 2/10 (John Goerzen, 2008-03-07 23:32)

h1. Using Git to contribute to Redmine 

 Redmine's source tree is stored in Subversion, and everything eventually feeds into there.    Some who are comfortable using Git prefer to use it for its branching and merging features, and because you don't need to have SVN commit access to make commits. 

 h1. Initialization 

 To start out, run these commands: 

 <pre> 
 git clone git://git.complete.org/branches/redmine-integration 
 cd redmine-integration 
 git config --add remote.origin.fetch +refs/remotes/svn/*:refs/remotes/svn/* 
 git fetch 
 </pre> 

 h2. Exploration 

 You can see all the branches that Git obtained for you: 

 <pre> 
 git branch -r | less 
 </pre> 

 You'll see output like this.    (Many lines omitted here) 

 <pre> <code> 
   origin/HEAD 
   origin/fb-bug-259-git 
   origin/fb-bug-261-issue-redirect 
   origin/fb-bug-641-context-done 
   svn/git 
   svn/issue_relations 
   svn/mailing_lists 
   svn/tags/0.6.3 
   svn/tags/0.6.3@1011 
   svn/time 
   svn/trunk 
   svn/wiki 
 </pre> </code> 

 The "origin" branches are being maintained in Git (no corresponding Subversion branch).    The svn branches are identical copies of the same branch in the Redmine Subversion repository. 

 You'll base your work off these branches. 

 h1. Starting Your Feature 

 With git, branches are cheap and merges are easy, so you'll usually want to start a new branch for each feature you work on.    A single branch will probably correspond to a single issue in Redmine when you submit the patch. 

 You'll want to base your patch on svn trunk.    So you'll set up a branch like so: 

 <pre> 
 $ git branch my-feature svn/trunk 
 Branch my-feature set up to track remote branch refs/remotes/svn/trunk. 
 $ git checkout my-feature 
 </pre> 

 The first line created a branch named @my-feature@, which will be based on svn/trunk.    The second command checks out that branch, which means that your working copy is switched to it, and any commits you make will be posted to that branch. 

 Note that the act of committing doesn't sent any patches to anyone else; as Git is distributed, commits are recorded locally only until you're ready to push them upstream. 

 You can run @git branch@ to see what branch you're on -- it'll have an asterisk next to it, like this: 

 <pre> 
 $ git branch 
   master 
 * my-feature 
 </pre> 

 h1. Working on your feature