Changes between Version 1 and Version 2 of Chimera2/git


Ignore:
Timestamp:
May 1, 2013, 11:45:11 AM (13 years ago)
Author:
Conrad Huang
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Chimera2/git

    v1 v2  
     1[[PageOutline]]
     2
    13= Chimera 2 Revision Control =
    24
    3 We will use '''git''' and '''git flow''' for revision control to manage Chimera 2 source code.  Development will follow the [http://nvie.com/posts/a-successful-git-branching-model/ Vincent Driessen's branching model] where the '''master''' branch is the release branch and the '''develop''' branch is the daily build branch.  The remainder of this document describes some common tasks using '''git'''.
     5We will use '''git''' and '''git flow''' for revision control to manage Chimera 2 source code.  Development will follow the [http://nvie.com/posts/a-successful-git-branching-model/ Vincent Driessen's branching model] where the '''master''' branch is the release branch and the '''develop''' branch is the daily build branch.  A ''team repository'' is the repository that is used to create release and daily builds, ''i.e.'', changes committed in developer repositories but not pushed to the team repository will not appear in either release or daily builds.
    46
    5 [[PageOutline]]
     7The remainder of this document describes some common tasks using '''git'''.
    68
    7 == Create Team Repository ==
    89== Create Developer Repository on plato ==
    9 == Use '''develop''' Branch Directly for Development ==
     10== Use ''develop'' Branch Directly for Development ==
    1011== Use Feature Branch for Development ==
    1112== Stash Modified Files before Switching Branches ==
    1213== Create Remote Repository ==
    1314== Use plato Repository to Coordinate Development on Multiple Hosts ==
     15== Create Team Repository ==
     16
     17In this section, examples refer to ''/var/tmp/conrad/example'' since the actual path ''/usr/local/projects/chimera2/git'' is already in use.  Examples in other sections of this document refer to the correct path.
     18
     19Create the bare '''git''' repository that will serve as the team repository for Chimera 2 source code.  Note that the repository is created for sharing within a group.  The '''chgrp''' command defines which group will have cloning and update privileges.  The access permissions such as the setgid bit of directories (meaning files created will inherit the group of the parent directory) in the repository is maintained by '''git''' and should not require manual intervention.
     20
     21{{{#!html
     22<pre style="margin-left:20px; margin-right:20px; border:solid 1px; padding:3px; background:white;">
     23<b style="color:#c22;">franklin:example conrad$ cd /var/tmp/conrad/example</b>
     24<b style="color:#c22;">franklin:example conrad$ git init --bare --shared=group chimera2.git</b>
     25Initialized empty shared Git repository in /var/tmp/conrad/example/chimera2.git/
     26<b style="color:#c22;">franklin:example conrad$ chgrp -R chimdev chimera2.git</b>
     27<b style="color:#c22;">franklin:example conrad$ ls -l</b>
     28total 4
     29drwxrwsr-x 7 conrad chimdev 3864 May  1 09:34 chimera2.git/
     30</pre>
     31}}}
     32
     33Create a bootstrap repository so that we can set up the initial configuration for the project.  The reason this repository is temporary is that the push/pull linkage between local and remote branches need to be set up when the branches are created, but are handled automatically during cloning after they have been created.  Since we will only use '''master''' and '''develop''' branches in the team repository, we can set them up now and developers who clone later will not have to worry about configuring the push/pull targets.
     34
     35{{{#!html
     36<pre style="margin-left:20px; margin-right:20px; border:solid 1px; padding:3px; background:white;">
     37<b style="color:#c22;">franklin:example conrad$ git clone --shared chimera2.git bootstrap</b>
     38Initialized empty Git repository in /var/tmp/conrad/example/bootstrap/.git/
     39warning: You appear to have cloned an empty repository.
     40<b style="color:#c22;">franklin:example conrad$ cd bootstrap</b>
     41/var/tmp/conrad/example/bootstrap
     42<b style="color:#c22;">franklin:bootstrap conrad$ ls -la</b>
     43total 12
     44drwxr-xr-x 3 conrad ferrin 3864 May  1 10:32 ./
     45drwxrwxr-x 5 conrad ferrin 3864 May  1 10:32 ../
     46drwxrwxr-x 7 conrad ferrin 3864 May  1 10:32 .git/
     47</pre>
     48}}}
     49
     50Use '''git flow''' to set up the branches in the bootstrap repository.  After initialization, we are on the '''develop''' branch where we add our initial files; '''xyzzy''' is our only file in this example.  The '''add -A''' command adds all modified and untracked files to the staging area; the '''commit''' command commits files in the staging area to the local repository; the '''push''' command pushes the state of the current branch from the local repository, '''bootstrap''', to the remote team repository, '''origin''', which represents the repository from which we are cloned ('''chimera2.git''' in this case).
     51
     52{{{#!html
     53<pre style="margin-left:20px; margin-right:20px; border:solid 1px; padding:3px; background:white;">
     54<b style="color:#c22;">franklin:bootstrap conrad$ git flow init -d</b>
     55Using default branch names.
     56No branches exist yet. Base branches must be created now.
     57Branch name for production releases: [master]
     58Branch name for "next release" development: [develop]
     59
     60How to name your supporting branch prefixes?
     61Feature branches? [feature/]
     62Release branches? [release/]
     63Hotfix branches? [hotfix/]
     64Support branches? [support/]
     65Version tag prefix? []
     66<b style="color:#c22;">franklin:bootstrap conrad$ git status</b>
     67# On branch develop
     68nothing to commit (working directory clean)
     69<b style="color:#c22;">franklin:bootstrap conrad$ echo hello > xyzzy</b>
     70<b style="color:#c22;">franklin:bootstrap conrad$ git add -A</b>
     71<b style="color:#c22;">franklin:bootstrap conrad$ git status</b>
     72# On branch develop
     73# Changes to be committed:
     74#   (use "git reset HEAD &lt;file&gt;..." to unstage)
     75#
     76#       new file:   xyzzy
     77#
     78<b style="color:#c22;">franklin:bootstrap conrad$ git commit -m "initial setup"</b>
     79[develop ff9b042] initial setup
     80 1 files changed, 1 insertions(+), 0 deletions(-)
     81 create mode 100644 xyzzy
     82<b style="color:#c22;">franklin:bootstrap conrad$ git push origin develop</b>
     83Counting objects: 5, done.
     84Delta compression using up to 64 threads.
     85Compressing objects: 100% (2/2), done.
     86Writing objects: 100% (5/5), 384 bytes, done.
     87Total 5 (delta 0), reused 0 (delta 0)
     88Unpacking objects: 100% (5/5), done.
     89To /var/tmp/conrad/example/chimera2.git
     90 * [new branch]      develop -> develop
     91</pre>
     92}}}
     93
     94Make the '''master''' branch match the '''develop''' branch.  The '''checkout''' command is used to switch from one branch to another; note that this command only uses the __local__ repository and does not require access to the team repository.
     95
     96{{{#!html
     97<pre style="margin-left:20px; margin-right:20px; border:solid 1px; padding:3px; background:white;">
     98<b style="color:#c22;">franklin:bootstrap conrad$ git checkout master</b>
     99Switched to branch 'master'
     100You have new mail in /var/spool/mail/conrad
     101<b style="color:#c22;">franklin:bootstrap conrad$ git merge develop</b>
     102Updating 76fd917..ff9b042
     103Fast-forward
     104 xyzzy |    1 +
     105 1 files changed, 1 insertions(+), 0 deletions(-)
     106 create mode 100644 xyzzy
     107<b style="color:#c22;">franklin:bootstrap conrad$ git push origin master</b>
     108Total 0 (delta 0), reused 0 (delta 0)
     109To /var/tmp/conrad/example/chimera2.git
     110 * [new branch]      master -> master
     111</pre>
     112}}}
     113
     114At this point, the team repository set up is complete.  All the files are under revision control and the bootstrap repository may be safely deleted.  The team repository, '''chimera2.git''', with '''master''' and '''develop''' branches, is ready for by developers.  Note that developers still have to set up and use '''git flow''' after cloning in order to follow the [http://nvie.com/posts/a-successful-git-branching-model/ Vincent Driessen's branching model] conveniently.
     115
     116{{{#!html
     117<pre style="margin-left:20px; margin-right:20px; border:solid 1px; padding:3px; background:white;">
     118<b style="color:#c22;">franklin:bootstrap conrad$ cd ..</b>
     119<b style="color:#c22;">franklin:example conrad$ ls -l</b>
     120total 12
     121drwxr-xr-x 3 conrad ferrin  3864 May  1 11:19 bootstrap/
     122drwxrwsr-x 7 conrad chimdev 3864 May  1 09:34 chimera2.git/
     123<b style="color:#c22;">franklin:example conrad$ rm -rf bootstrap</b>
     124</pre>
     125}}}