Project

General

Profile

Git-maus » History » Version 33

Dobbs, Adam, 24 February 2017 20:25

1 1 Dobbs, Adam
h1. Git-maus
2
3 5 Dobbs, Adam
Besides Launchpad and bazaar MAUS has beta level support for git and"github":https://github.com/mice-software/maus. At the moment code updates for the trunk cannot be accepted from github however, only via Launchpad and bazaar.
4 1 Dobbs, Adam
5
h2. Development
6
7 28 Dobbs, Adam
h3. Overview
8 1 Dobbs, Adam
9 28 Dobbs, Adam
This following section will guide you to:
10
11 24 Dobbs, Adam
# Create an account on GitHub
12
# Add an ssh key to your account
13
# Fork the MAUS repository on github into your personal github account
14
# Make a local copy on your computer of your fork of MAUS
15 1 Dobbs, Adam
# Create a new development branch within this repository locally
16 26 Dobbs, Adam
# Make and changes and commit these changes to this branch
17 1 Dobbs, Adam
# Push your development branch and these changes to your github MAUS fork
18 28 Dobbs, Adam
# Create a Jenkins test server job for your development branch
19 1 Dobbs, Adam
# Propose merging your changes back to the MAUS trunk via github
20 31 Dobbs, Adam
# Merge changes from the MAUS trunk into your development branch
21 1 Dobbs, Adam
22 28 Dobbs, Adam
h3. Step-by-step guide
23 2 Dobbs, Adam
24 26 Dobbs, Adam
# Create an account on "github":https://github.com/
25 25 Dobbs, Adam
# "Add an ssh key":https://help.github.com/articles/connecting-to-github-with-ssh/ to your account
26 26 Dobbs, Adam
# Fork the MAUS repository on github into your personal github account
27 25 Dobbs, Adam
## Go to "MAUS github page":https://github.com/mice-software/maus and login into github
28 1 Dobbs, Adam
## Click "Fork" in the top right of the screen, selecting the option to fork to your own account
29 25 Dobbs, Adam
    !http://micewww.pp.rl.ac.uk/attachments/8360/GitHubForkScaled.png!
30 1 Dobbs, Adam
## Select your own account from the options that appear for where to fork MAUS
31 26 Dobbs, Adam
# Make a local copy (clone) on your computer of your fork of MAUS
32
## Copy the address of your new fork from github (something like @git@github.com:jbloggs/maus.git@, where jbloggs is your github username)
33
## Clone your repository:
34 1 Dobbs, Adam
<pre>
35 26 Dobbs, Adam
git clone git@github.com:jbloggs/maus.git
36 1 Dobbs, Adam
</pre>
37 2 Dobbs, Adam
where jbloggs is your github username.
38 26 Dobbs, Adam
# Create a new development branch within this repository locally
39
## cd into the directory created by the clone command (maus by default)
40
## Take a look at the branches present with:
41 2 Dobbs, Adam
<pre>
42 26 Dobbs, Adam
git branch -av
43
</pre>
44
## Pull down the merge branch from your remote github repository into the new local repository:
45
<pre>
46 1 Dobbs, Adam
git checkout merge
47 26 Dobbs, Adam
</pre>
48
## Create a new development branch in the local repository by forking the merge branch:
49
<pre>
50 1 Dobbs, Adam
git checkout -b my-feature-branch
51 27 Dobbs, Adam
</pre>
52 26 Dobbs, Adam
## Observe the new state of your local repository with:
53
<pre>
54
git branch -av
55 2 Dobbs, Adam
</pre>
56 26 Dobbs, Adam
# Make changes and commit these changes to the local development branch
57
## Edit some files, creating some wonderful new feature for the benefit of mousekind
58
## Stage the changes:
59 2 Dobbs, Adam
<pre>
60 1 Dobbs, Adam
git add AlteredFile1.cc AlteredFile2.cc
61 2 Dobbs, Adam
</pre>
62 26 Dobbs, Adam
## Commit the changes:
63 1 Dobbs, Adam
<pre>
64 2 Dobbs, Adam
git commit -m 'My excellent new feature, closing issue ###'
65 26 Dobbs, Adam
</pre>
66 28 Dobbs, Adam
# Push your development branch and these changes to your github MAUS fork
67 26 Dobbs, Adam
<pre>
68 3 Dobbs, Adam
git push origin my-feature-branch
69 26 Dobbs, Adam
</pre>
70 28 Dobbs, Adam
# Create a Jenkins test server job for your development branch
71
## The MAUS test server can be found at: "http://test.mice.rl.ac.uk":http://test.mice.rl.ac.uk
72 33 Dobbs, Adam
## Either email the head of MAUS requesting a test branch and giving your repository url and development branch id, or go to the test server, create a new item, copying an existing git-based test job, and edit the configuration with your repository url and branch name
73 29 Dobbs, Adam
# Propose merging your changes back to the MAUS trunk via github
74 28 Dobbs, Adam
## Run the Jenkins test server job on your development branch
75 30 Dobbs, Adam
## When Jenkins has passed (and not before), return to your repository page on github and select @my-feature-branch@ from the drop-down menu on the left (below is an example where the feature branch is named "event-selection")
76
    !http://micewww.pp.rl.ac.uk/attachments/8362/GitHubBranchesScaled.png!
77 1 Dobbs, Adam
## Click the "Pull request" button to propose merging into the trunk
78 31 Dobbs, Adam
## Make sure your branch is comfortable for merging, that is it does not lead to any conflicts when github attempts a mock merge into the central MAUS merge branch. If your branch is not comfortable for merging, edit some more until it is, commit and push, then try again
79
## Creating a pull request will alter the MAUS maintainers you want your code added to the trunk, and begin a conversation between you and them if any changes are required first
80
# Merge changes from the MAUS trunk into your development branch
81 32 Dobbs, Adam
## One reason your development branch may not automatically be comfortable for merging back in the central MAUS merge branch is if someone has pushed changes there since you forked your repository. This can be dealt with by merging the changes from the central MAUS repository into your repository.
82 31 Dobbs, Adam
## First, we must tell your local copy of your repository about the central MAUS repository on github. This is called adding are remote. Note your local repository already has one remote, your repository on github - it has the default name @origin@. Add the central MAUS repository on github as a new remote called @trunk@ with:
83
<pre>
84
git remote add trunk git@github.com:mice-software/maus.git
85
</pre>
86
## Look at your repository structure again with:
87
<pre>
88
git branch -av
89
</pre>
90
## Make sure we are in our feature branch:
91
<pre>
92
git checkout my-feature-branch
93
</pre>
94
## Now merge from the central MAUS merge branch into your feature branch with:
95
<pre>
96
git pull trunk merge
97
</pre>
98
## If there are any conflicts listed, examine each file in turn, make the changes needed, and then resolve the conflicts with:
99
<pre>
100
git add MyFixedFile.cc
101
git commit -m 'Merged from the trunk'
102
</pre>
103
## Now push the changes back to your github repository with:
104
<pre>
105
git push origin my-feature-branch
106
</pre>