RedmineGitTracking » History » Version 2
John Goerzen, 2008-03-07 23:32
1 | 1 | John Goerzen | h1. Using Git to contribute to Redmine |
---|---|---|---|
2 | |||
3 | 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. |
||
4 | |||
5 | h1. Initialization |
||
6 | |||
7 | To start out, run these commands: |
||
8 | |||
9 | <pre> |
||
10 | git clone git://git.complete.org/branches/redmine-integration |
||
11 | cd redmine-integration |
||
12 | git config --add remote.origin.fetch +refs/remotes/svn/*:refs/remotes/svn/* |
||
13 | git fetch |
||
14 | </pre> |
||
15 | |||
16 | h2. Exploration |
||
17 | |||
18 | You can see all the branches that Git obtained for you: |
||
19 | |||
20 | <pre> |
||
21 | git branch -r | less |
||
22 | </pre> |
||
23 | |||
24 | You'll see output like this. (Many lines omitted here) |
||
25 | |||
26 | 2 | John Goerzen | <pre> |
27 | 1 | John Goerzen | origin/HEAD |
28 | origin/fb-bug-259-git |
||
29 | origin/fb-bug-261-issue-redirect |
||
30 | origin/fb-bug-641-context-done |
||
31 | svn/git |
||
32 | svn/issue_relations |
||
33 | svn/mailing_lists |
||
34 | svn/tags/0.6.3 |
||
35 | svn/tags/0.6.3@1011 |
||
36 | svn/time |
||
37 | svn/trunk |
||
38 | svn/wiki |
||
39 | 2 | John Goerzen | </pre> |
40 | 1 | John Goerzen | |
41 | 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. |
||
42 | |||
43 | You'll base your work off these branches. |
||
44 | |||
45 | h1. Starting Your Feature |
||
46 | 2 | John Goerzen | |
47 | 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. |
||
48 | |||
49 | You'll want to base your patch on svn trunk. So you'll set up a branch like so: |
||
50 | |||
51 | <pre> |
||
52 | $ git branch my-feature svn/trunk |
||
53 | Branch my-feature set up to track remote branch refs/remotes/svn/trunk. |
||
54 | $ git checkout my-feature |
||
55 | </pre> |
||
56 | |||
57 | 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. |
||
58 | |||
59 | 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. |
||
60 | |||
61 | You can run @git branch@ to see what branch you're on -- it'll have an asterisk next to it, like this: |
||
62 | |||
63 | <pre> |
||
64 | $ git branch |
||
65 | master |
||
66 | * my-feature |
||
67 | </pre> |
||
68 | |||
69 | h1. Working on your feature |