GIT und Redmine A brief introduction into the use of Redmine and GIT @ MIUB.

42
GIT und Redmine A brief introduction into the use of Redmine and GIT @ MIUB

Transcript of GIT und Redmine A brief introduction into the use of Redmine and GIT @ MIUB.

Page 1: GIT und Redmine A brief introduction into the use of Redmine and GIT @ MIUB.

GIT und RedmineA brief introduction into the use of

Redmine and GIT @ MIUB

Page 2: 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

Page 3: GIT und Redmine A brief introduction into the use of Redmine and GIT @ MIUB.

Open-Source, Web-based tool for collaboration

Documentation of Projects

Wiki

Forum

Documents / Files

Ticket system

What is Redmine?

Page 4: GIT und Redmine A brief introduction into the use of Redmine and GIT @ MIUB.

What is Redmine?

Collaboration on source code - level

Integration with revision control systems

Source-Code Browser

Release-Planning with Milestones

Page 5: GIT und Redmine A brief introduction into the use of Redmine and GIT @ MIUB.

ProjectsProjects 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.

Page 6: GIT und Redmine A brief introduction into the use of Redmine and GIT @ MIUB.

WikiRedmine 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.

Page 7: GIT und Redmine A brief introduction into the use of Redmine and GIT @ MIUB.

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

Page 8: GIT und Redmine A brief introduction into the use of Redmine and GIT @ MIUB.

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.

Page 9: GIT und Redmine A brief introduction into the use of Redmine and GIT @ MIUB.

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.

Page 10: GIT und Redmine A brief introduction into the use of Redmine and GIT @ MIUB.

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?

Page 11: GIT und Redmine A brief introduction into the use of Redmine and GIT @ MIUB.

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.

Why do I care?

Page 12: GIT und Redmine A brief introduction into the use of Redmine and GIT @ MIUB.

http://git.meteo.uni-bonn.de

Redmine @ MIUB

Page 13: GIT und Redmine A brief introduction into the use of Redmine and GIT @ MIUB.

Let’s have a goosey

(Let’s take a look)

Page 14: GIT und Redmine A brief introduction into the use of Redmine and GIT @ MIUB.

Redmine @ MIUB

Redmine is available @ MIUB using the following URLhttp://git.meteo.uni-bonn.de

Accounts have to be obtained by writing an Email to the admins, Mark ([email protected]) or Stefan ([email protected])

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.)

Page 15: GIT und Redmine A brief introduction into the use of Redmine and GIT @ MIUB.

Redmine @ MIUBUsers 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.

Page 16: GIT und Redmine A brief introduction into the use of Redmine and GIT @ 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.

Redmine @ MIUB

Page 17: GIT und Redmine A brief introduction into the use of Redmine and GIT @ MIUB.

Links

Redmine Homepage:http://www.redmine.org/

Redmine Tutorial Section:http://www.redmine.org/projects/redmine/wiki/Tutorials

Page 18: GIT und Redmine A brief introduction into the use of Redmine and GIT @ MIUB.

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

Page 19: GIT und Redmine A brief introduction into the use of Redmine and GIT @ MIUB.

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

Page 20: GIT und Redmine A brief introduction into the use of Redmine and GIT @ MIUB.

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.

Page 21: GIT und Redmine A brief introduction into the use of Redmine and GIT @ MIUB.

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.

Page 22: GIT und Redmine A brief introduction into the use of Redmine and GIT @ MIUB.

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.

Page 23: GIT und Redmine A brief introduction into the use of Redmine and GIT @ MIUB.

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!

Page 24: GIT und Redmine A brief introduction into the use of Redmine and GIT @ MIUB.

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

Page 25: GIT und Redmine A brief introduction into the use of Redmine and GIT @ MIUB.

Classical Revision Control(Central Repository)

Page 26: GIT und Redmine A brief introduction into the use of Redmine and GIT @ MIUB.

GIT (Decentralized Collaboration)

Page 27: GIT und Redmine A brief introduction into the use of Redmine and GIT @ MIUB.

Crash CourseHelp!

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

Page 28: GIT und Redmine A brief introduction into the use of Redmine and GIT @ MIUB.

Help!‘git help’ shows you an overview:

$ git helpusage: git [--version] [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path] [-p|--paginate|--no-pager] [--no-replace-objects] [--bare] [--git-dir=<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 ....

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] [--ignore-missing] [--] [<filepattern>...]DESCRIPTION This command updates the index using the current content found in the

• To get specific help on a command listed in ‘git help’, use ‘git help <cmd>’:

Page 29: GIT und Redmine A brief introduction into the use of Redmine and GIT @ MIUB.

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 [email protected]

git config --global color.diff autogit config --global color.status autogit config --global color.branch auto

• It helps a lot reading git output, when colors are switched on (optional):

Page 30: GIT und Redmine A brief introduction into the use of Redmine and GIT @ MIUB.

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 initInitialized empty Git repository in ....

Page 31: GIT und Redmine A brief introduction into the use of Redmine and GIT @ MIUB.

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

Page 32: GIT und Redmine A brief introduction into the use of Redmine and GIT @ MIUB.

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#

Page 33: GIT und Redmine A brief introduction into the use of Redmine and GIT @ MIUB.

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”

Page 34: GIT und Redmine A brief introduction into the use of Redmine and GIT @ MIUB.

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

Page 35: GIT und Redmine A brief introduction into the use of Redmine and GIT @ MIUB.

View the log‘git log’ gives you a complete record of commit messages to date.

dhcp20:radolan simon$ git logcommit 21d32d841556bc023b5bd800862a6715e7682bcfAuthor: Jürgen Simon <[email protected]>Date: Tue Dec 13 17:52:36 2011 +0100 Made the scaling factor public in coordinate systemcommit 9c821d4036d1122f7608feb255715504d7b53eeaAuthor: Jürgen Simon <[email protected]>Date: Mon Dec 12 12:24:40 2011 +0100 removed commented out codecommit d47d0d9ad52cf94f351ac7cd35a20540f778a911Author: Jürgen Simon <[email protected]>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....

Page 36: GIT und Redmine A brief introduction into the use of Redmine and GIT @ MIUB.

Upload a local repository to a remote

repositoryImportant 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.uni-bonn.de/git/<projectname>

• Step 2 : push local repository to remote location as the ‘master’ branch:

git push origin master

Page 37: GIT und Redmine A brief introduction into the use of Redmine and GIT @ MIUB.

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/

• The main branch is called ‘master’, you automatically check it out when you omit the branch argument

• 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.

git clone http://git.meteo.uni-bonn.de/git/radolan/ libradolan-1.0

Page 38: GIT und Redmine A brief introduction into the use of Redmine and GIT @ MIUB.

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

Page 39: GIT und Redmine A brief introduction into the use of Redmine and GIT @ MIUB.

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_repositorygit push http://git.meteo.uni-bonn.de/git/projects/radolangit 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

Page 40: GIT und Redmine A brief introduction into the use of Redmine and GIT @ MIUB.

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:

https://git.meteo.uni-bonn.de/projects/radolan

https://git.meteo.uni-bonn.de/git/radolan

Project

Repository

Page 41: GIT und Redmine A brief introduction into the use of Redmine and GIT @ MIUB.

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’.

Page 42: GIT und Redmine A brief introduction into the use of Redmine and GIT @ MIUB.

Links

git help tutorial

http://git-scm.com

http://www.vogella.de/articles/Git/article.html

http://schacon.github.com/git/gittutorial.html