GIT_Redmine

advertisement
GIT und Redmine
A brief introduction into the use of
Redmine and GIT @ MIUB
Redmine
What is Redmine?
Why do I care?
Redmine @ Miub
Links
What is Redmine?
Open-Source, Web-based tool for
collaboration
Documentation of Projects
Wiki
Forum
Documents / Files
Ticket system
What is Redmine?
Collaboration on source code - level
Integration with revision control systems
Source-Code Browser
Release-Planning with Milestones
Projects
Projects are the top-level organization unit in Redmine
Each project comes with it’s own Wiki, Forums,
Files/Documents etc.
The project manager maintains the people and roles in
the project. He is responsible for maintaining the
read/write access assigned directly or through roles
By default, projects are ‘private’, which means only
members can even see them. Projects can also made
public. That does not mean everyone can read
everything, this depends on the settings.
Wiki
Redmine uses a slightly modified WIKI syntax,
formatting help is available in the editor and online.
Wiki is the ideal place to work on collaboration
information, like data formats, interface definitions, build
instructions etc.
The WiKi is also an ideal place to write HOWTO’s,
FAQs, literature and link collections or similar
information, which is designed to bring newcomers up
to speed.
The WIKI is not the right place for discussions. For
those, use Forum.
Documents/Files
Documents come in two categories: user
documentation and technical documentation
Files can be anything, they can also be associated with
a version
Documents and Files are only searched by title or
description, the content is not indexed for the search
box. Therefore use the title/description fields properly to
allow your stuff to be found more easily
Issue Tracker (Issues)
Think of issues as “To-Do’s” with various types:
Bug - A flaw in the software/work
Feature - A code feature or somehow separable
piece of work
Support - An activity to support/facilitate.
Issues can help structure collaborative efforts. They are
not means to be used as ‘leash’. Proper use of issues
can show up dependencies and blocks in the
development.
If you provide dates on issues, Gantt - Charts can yield
graphical representations of issue dependencies and
timelines.
Forum
Redmine provides a simple forum system. The forums
are separate per Project.
Forum are more appropriately used for online
discussions in distributed teams than Wiki.
Forum entries are also indexed for searches.
Why do I care?
Redmine allows you to work on complex
matters in a structured fashion with many
participants in Wiki or Forum
Project documentation and source code are
readily available at a single point, which saves
time and makes things a lot easier introducing
new colleagues.
Searchable content saves a lot of time when
looking for specific info.
Why do I care?
Well documented projects increase efficiency,
people do not re-invent the wheel all the time.
When working with many people on source
code, tickets can help to structure the work by
showing up dependencies and blocks.
Fine grained control over permissions to use
individual modules, read or write can provide
an easy way to facilitate cooperation even with
outsiders.
Redmine @ MIUB
http://git.meteo.uni-bonn.de
Let’s have a goosey
•
(Let’s take a look)
Redmine @ MIUB
Redmine is available @ MIUB using the following URL
http://git.meteo.uni-bonn.de
Accounts have to be obtained by writing an Email to the
admins, Mark (mertes@uni-bonn.de) or Stefan
(heinzelmann@uni-bonn.de)
Top-Level projects have to be created by the Admins.
Sub-Projects can be handled by the project manager.
Managers can add people to their projects and assign
them roles (Developer, Manager, Guest, etc.)
Redmine @ MIUB
Users are assigned one or many roles when the
manager adds them to the project.
Currently, we have three roles (per Project):
Manager (Project Leader)
Developer (Everyone else)
Read-Only (Guests)
The roles vary in their permissions to change project
settings, tickets, access to code etc. If you need
different roles or permissions in your project, speak to
the admins about it.
Redmine @ MIUB
The current state is an ongoing experiment. If you feel
you need different roles/permissions/modules etc. in
your project, feel free to talk to the admins to modify the
system according to your needs.
Links
Redmine Homepage:
http://www.redmine.org/
Redmine Tutorial Section:
http://www.redmine.org/projects/redmine/wiki/
Tutorials
GIT
What is GIT?
What is revision control, for that matter?
And I need this because ... ?
What is special about GIT?
Crash Course
Integration Features GIT/Redmine
Links
What is GIT?
GIT (British for a worthless or foolish person Webster’s dictionary)
Revision-Control - System of the latest
generation, developed by Linus Thorvalds
(Linux)
Distributed revision control with offline
capabilities
What is Revision
Control?
Source code or documents are ‘checked in’
into a repository
The repository tracks changes and assigns
each change a number (revision).
It is possible to check out every past revision
of every file and compare/revert. Sort of ‘undo’
on cool-aid.
What is Revision
Control?
Revision-Control - Systems are chiefly a way
of collaborating. They offer tools for
Synchronizing changes with a central
repository between users
Handling conflicts and merges with edits of
other users
Branching out and re-integrating parts.
And I need this because
... ?
Working with source code is much safer. No
need to store ‘versions’ of your code, which
tends to get messy.
Mistakes are easily remedied,. Simply revert to
a previous revision and all is forgiven.
Stuff is stored safe and sound, no need to worry
about scratched CDs, crashed hard-drives or
other physical threats.
And I need this because
... ?
Collaboration with others on the same code is
much, much easier with RCS.
RCS can handle more than source-code. You
can check in other resources like Documents,
Presentations, Images, all sorts of binary
information.
However: avoid checking in large data files,
keep in mind that NOTHING EVER gets deleted
in a RCS!
What is special about
GIT?
Each developer has an independent, complete
copy of the repository.
You can work offline and still commit.
It is possible to synchronize against multiple
repositories
Classical Revision Control
(Central Repository)
GIT
(Decentralized Collaboration)
Crash Course
Help!
Basic Configuration
Initialize a local repository
Add / Remove files to / from a local repository
The GIT index
Commit changes to a local repository
Revert changes from a local repository
View the commit history
Upload a local repository to a remote repository
Synchronize changes with a remote repository
Help!
‘git help’ shows you an overview:
$ git helpusage: git [--version] [--exec-path[=<path>]] [--html-path] [--man-path] [--infopath]
[-p|--paginate|--no-pager] [--no-replace-objects] [--bare]
[--gitdir=<path>] [--work-tree=<path>] [--namespace=<name>]
[-c name=value] [--help]
<command> [<args>]The most commonly used git commands are:
add
Add file contents to
the index
bisect
Find by binary search the change that introduced a bug
branch
List, create, or delete branches
checkout
Checkout a branch or paths to the working tree
....
•
To get specific help on a command listed in ‘git help’, use ‘git help
<cmd>’:
GIT-ADD(1)
Git Manual
GIT-ADD(1)NAME
git-add - Add file contents to the indexSYNOPSIS
git add [-n] [-v]
[--force | -f] [--interactive | -i] [--patch | -p]
[--edit | -e] [--all | [-update | -u]] [--intent-to-add | -N]
[--refresh] [--ignore-errors] [--ignoremissing] [--]
[<filepattern>...]DESCRIPTION
This command updates the
index using the current content found in the
Basic Configuration
‘git config’ allows you to change some settings in your local git
instance. An important use of the config command is to identify
yourself:
git config --global user.name "Your Name Comes Here"
git config --global user.email
you@yourdomain.example.com
•
It helps a lot reading git output, when colors are switched on
(optional):
git config --global color.diff auto
git config --global color.status auto
git config --global color.branch auto
Initialize a local repository
‘git init’ turns the current directory into a repository.
Ideally, run this in the root folder of the project you wish to manage
with GIT
This is a full-flung repository already, you can start working by
adding files, committing etc. No server involvement is required.
$ git init
Initialized empty Git repository in ....
Add / Remove files to / from a local
repository
‘git add’ adds files to the revision control
‘git rm’ removes files from the revision control. Be careful! The rm
command also removes the file in your directory.
You need to commit before the changes become permanent.
$ git add *.cpp
$ git rm example.h
The GIT Index
The index is an intermediary stage between your directory (working
tree) and your repository.
The index represents the current changes. You can check the index
with the command ‘git status’
dhcp20:test simon$ git status# On branch master# Changes to be committed:#
(use "git reset HEAD <file>..." to unstage)## new file:
c.txt## Changes
not staged for commit:#
(use "git add/rm <file>..." to update what will
be committed)#
(use "git checkout -- <file>..." to discard changes in
working directory)##deleted:
a.txt# modified:
b.txt#
Commit changes to a local repository
‘git commit’ saves the changes you made to the local repository.
This includes files you altered, added or removed. The changes are
represented by the index mentioned before.
Use the flag -a to stage all deleted and modified files but not new
files you have not told git about yet.
Always add a message to your commit with the flag -m. Make the
message descriptive and meaningful.
$ git commit -a -m “updated the example files”
Revert changes from a local
repository
If you wish to undo all uncommitted changes to a path in the
working tree since the last commit, use the ‘git checkout’ command:
git checkout a.txt
•
If you wish to undo all uncommitted changes to the last commit, use
reset to revert the working tree:
git reset --hard
•
In order to undo committed changes, use the revert command:
git revert HEAD
View the log
‘git log’ gives you a complete record of commit messages to date.
dhcp20:radolan simon$ git logcommit
21d32d841556bc023b5bd800862a6715e7682bcfAuthor: Jürgen Simon
<simon@webtecc.com>Date:
Tue Dec 13 17:52:36 2011 +0100
Made the
scaling factor public in coordinate systemcommit
9c821d4036d1122f7608feb255715504d7b53eeaAuthor: Jürgen Simon
<simon@webtecc.com>Date:
Mon Dec 12 12:24:40 2011 +0100
removed
commented out codecommit d47d0d9ad52cf94f351ac7cd35a20540f778a911Author:
Jürgen Simon <simon@webtecc.com>Date:
Mon Dec 12 12:19:53 2011 +0100
Added classes and a utility to transform radolan scans to shapefile
format. This can be used to display radolan scans in a standard GIS tool,
like uDig or QGis....
Upload a local repository to
a remote repository
Important Pre-Requisite: the server has a remote repository file at
the given URL
Step 1: create a shortcut to the remote location. The usual name to
use is ‘origin’. This will make subsequent commands a lot easier:
git remote add origin http://<username>:<password>@git.meteo.unibonn.de/git/<projectname>
•
Step 2 : push local repository to remote location as the ‘master’
branch:
git push origin master
Synchronize changes with a remote
repository
Use ‘git clone <URL> <branch name>’ to create a local copy of a
remote repository.
git clone http://git.meteo.uni-bonn.de/git/radolan/ libradolan-1.0
•
The main branch is called ‘master’, you automatically check it out
when you omit the branch argument
git clone http://git.meteo.uni-bonn.de/git/radolan/
•
•
•
This is equivalent to ‘svn checkout’ or ‘cvs checkout’.
The source-repository is automatically added to the list of shortcuts
as ‘origin’.
Once clone is done, you have a complete copy of the repository on
your hard-drive, including all changes.
Synchronize changes with a remote
repository
In order to pull in changes from a remote repository, use the
‘git pull <remote shortcut> <branch name>’ command.
This is equivalent to ‘svn update’ or ‘cvs update’
This will pull all the changes from the remote repository into your
local repository (basically mirror it)
git pull origin master
•
It’s possible to omit the source, if the ‘origin’ shortcut is defined. In that
case you can pull all changes from ‘origin’ (master branch) by simply
using:
git pull
Synchronize changes with a remote
repository
In order to push changes up to a remote repository, so they can get
pulled by your colleagues, use the ‘git push <url> or <remote
shortcut>’ command.
git push ../another_repository
git push http://git.meteo.uni-bonn.de/git/projects/radolan
git push origin
•
•
•
Equivalent to ‘svn commit’ or ‘cvs commit’.
Uploads your committed changes to the remote repository. Anything
you have not committed at the time is not pushed
It’s possible to omit the source, if the ‘origin’ shortcut is defined. In
that case you can push all changes using:
git push
Integration Features
GIT/Redmine
The source-code browser provides a nice tool to keep up to speed
on changes. This becomes more important as the groups get
bigger.
Projects are integrated with the source-code revision system (GIT).
When a new project is created, a new repository file is automatically
created alongside, so you do not have to take care of it:
Project
https://git.meteo.uni-bonn.de/projects/radolan
Repository
https://git.meteo.uni-bonn.de/git/radolan
Integration Features
GIT/Redmine
Project/Sub-Project relationships are unfortunately not mirrored
automatically in GIT. If you need this, you have to do this in GIT
yourself.
When committing changes in git, messages can contain references to
Redmine-Tickets etc., which will turn into proper links. Example:
‘Worked some on #434’.
Tickets can automatically be closed by prepending the ticket number
with ‘fixes’. Example: ‘fixes #434’.
Links
git help tutorial
http://git-scm.com
http://www.vogella.de/articles/Git/article.html
http://schacon.github.com/git/gittutorial.html
Download