| Version 2 (modified by , 13 years ago) ( diff ) |
|---|
Chimera 2 Revision Control
We will use git and git flow for revision control to manage Chimera 2 source code. Development will follow the ​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.
The remainder of this document describes some common tasks using git.
Create Developer Repository on plato
Use develop Branch Directly for Development
Use Feature Branch for Development
Stash Modified Files before Switching Branches
Create Remote Repository
Use plato Repository to Coordinate Development on Multiple Hosts
Create Team Repository
In 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.
Create 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.
franklin:example conrad$ cd /var/tmp/conrad/example franklin:example conrad$ git init --bare --shared=group chimera2.git Initialized empty shared Git repository in /var/tmp/conrad/example/chimera2.git/ franklin:example conrad$ chgrp -R chimdev chimera2.git franklin:example conrad$ ls -l total 4 drwxrwsr-x 7 conrad chimdev 3864 May 1 09:34 chimera2.git/
Create 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.
franklin:example conrad$ git clone --shared chimera2.git bootstrap Initialized empty Git repository in /var/tmp/conrad/example/bootstrap/.git/ warning: You appear to have cloned an empty repository. franklin:example conrad$ cd bootstrap /var/tmp/conrad/example/bootstrap franklin:bootstrap conrad$ ls -la total 12 drwxr-xr-x 3 conrad ferrin 3864 May 1 10:32 ./ drwxrwxr-x 5 conrad ferrin 3864 May 1 10:32 ../ drwxrwxr-x 7 conrad ferrin 3864 May 1 10:32 .git/
Use 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).
franklin:bootstrap conrad$ git flow init -d Using default branch names. No branches exist yet. Base branches must be created now. Branch name for production releases: [master] Branch name for "next release" development: [develop] How to name your supporting branch prefixes? Feature branches? [feature/] Release branches? [release/] Hotfix branches? [hotfix/] Support branches? [support/] Version tag prefix? [] franklin:bootstrap conrad$ git status # On branch develop nothing to commit (working directory clean) franklin:bootstrap conrad$ echo hello > xyzzy franklin:bootstrap conrad$ git add -A franklin:bootstrap conrad$ git status # On branch develop # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # new file: xyzzy # franklin:bootstrap conrad$ git commit -m "initial setup" [develop ff9b042] initial setup 1 files changed, 1 insertions(+), 0 deletions(-) create mode 100644 xyzzy franklin:bootstrap conrad$ git push origin develop Counting objects: 5, done. Delta compression using up to 64 threads. Compressing objects: 100% (2/2), done. Writing objects: 100% (5/5), 384 bytes, done. Total 5 (delta 0), reused 0 (delta 0) Unpacking objects: 100% (5/5), done. To /var/tmp/conrad/example/chimera2.git * [new branch] develop -> develop
Make 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.
franklin:bootstrap conrad$ git checkout master Switched to branch 'master' You have new mail in /var/spool/mail/conrad franklin:bootstrap conrad$ git merge develop Updating 76fd917..ff9b042 Fast-forward xyzzy | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) create mode 100644 xyzzy franklin:bootstrap conrad$ git push origin master Total 0 (delta 0), reused 0 (delta 0) To /var/tmp/conrad/example/chimera2.git * [new branch] master -> master
At 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 ​Vincent Driessen's branching model conveniently.
franklin:bootstrap conrad$ cd .. franklin:example conrad$ ls -l total 12 drwxr-xr-x 3 conrad ferrin 3864 May 1 11:19 bootstrap/ drwxrwsr-x 7 conrad chimdev 3864 May 1 09:34 chimera2.git/ franklin:example conrad$ rm -rf bootstrap
![[Chimera Issue Tracking System]](/trac/chimera/chrome/site/chimera_logo.png)