ITK/Git/Simple: Difference between revisions

From KitwarePublic
< ITK‎ | Git
Jump to navigationJump to search
(Wrote a simple one page guide to ITK development with Git and Gerrit)
 
(Added a link to the PDF guide to ITK development.)
Line 1: Line 1:
==Introduction==
==Introduction==


This document is intended to give the bare minimum to get up and running with ITK, and to develop and commit code to the main ITK repository. Please refer to the general [[ITK/Git| Git guide]] for more details on Git configuration, the branchy workflow employed and the topic stage used for integration of topic branches.
This document is intended to give the bare minimum to get up and running with ITK, and to develop and commit code to the main ITK repository. There is a [[Media:GitITKCheatSheet.pdf|one page PDF cheat sheet]] intended to be a desk reference. Please refer to the general [[ITK/Git| Git guide]] for more details on Git configuration, the branchy workflow employed and the topic stage used for integration of topic branches.


All work should be developed in a topic branch, which is branched from the master branch. The topic branch should be staged and merged into master when ready. This facilitates a workflow where big changes can be made, tested and integrated into the mainline development tree (master) when ready for inclusion.
All work should be developed in a topic branch, which is branched from the master branch. The topic branch should be staged and merged into master when ready. This facilitates a workflow where big changes can be made, tested and integrated into the mainline development tree (master) when ready for inclusion.

Revision as of 21:55, 2 November 2010

Introduction

This document is intended to give the bare minimum to get up and running with ITK, and to develop and commit code to the main ITK repository. There is a one page PDF cheat sheet intended to be a desk reference. Please refer to the general Git guide for more details on Git configuration, the branchy workflow employed and the topic stage used for integration of topic branches.

All work should be developed in a topic branch, which is branched from the master branch. The topic branch should be staged and merged into master when ready. This facilitates a workflow where big changes can be made, tested and integrated into the mainline development tree (master) when ready for inclusion.

Initial Setup

Assuming you have your SSH key set up correctly. Run the following to clone ITK:

$ git clone --recursive git://itk.org/ITK.git ITK
$ cd ITK
$ ./Utilities/SetupForDevelopment.sh

The last step installs local hooks, adds a topic stage, Gerrit and sets up some useful Git aliases that will be used later.

Updating ITK

To update ITK (pullall updates submodules and ITK):

$ git checkout master
$ git pullall

Starting a Topic Branch

To start a new topic branch:

$ git fetch
$ git checkout -b my-topic origin/master

Develop on this topic branch, make commits using, (omit the -m to use an editor)

$ git add file1 file2 file3
$ git commit -v

Pushing Your Changes for Review

You can check what commits will be pushed to Gerrit for review,

$ git prepush

To push those commits in your topic branch for review by the community,

$ git gerrit-push

Staging and Publishing a Topic to Next and Master

Once your topic branch has been successfully reviewed, from your topic branch, to merge your change(s) into master:

$ git stage-push
$ git stage-merge

Deleting Topic Branches

Once you are done, you should delete your topic branch (as it is merged into master and complete).

$ git checkout master
$ git pull
$ git branch -d my-topic

The last line will only succeed if you have correctly merged your branch to master. Using -D instead of -d will force the deletion of an unmerged topic branch (warning - you could lose commits).