Skip to content

GitWorkflow

uboot edited this page Jan 18, 2013 · 12 revisions

Note: If you are familiar with git it is obviously okay to use any other git server to host your personal repository and to skip the sections below.

Note for stromx-studio: The guide is also applicable for the repository of stromx-studio. To obtain the sources of stromx-studio and commit changes to them simple replace stromx by stromx-studio in all instructions below.

Get a personal repository

Personal repository on github

Create a personal github account and create a fork of either the stromx or the stromx-studio repositories using the web interface (i.e. the button "Fork"). For unknown reasons every user is advised to choose a nickname which is somehow connected to submarines. Replace submarine in the instructions below with your nickname.

Then create a local clone of the fork of the stromx repository on your computer:

> git clone git@github.com:submarine/stromx.git
> cd stromx

Any other personal repository

Create an empty local repository on your computer:

> mkdir stromx
> cd stromx
> git init

If you use any other git hosting service (e.g. gitorious etc.) you can now add a (presumably empty) personal remote repository at this service as the remote origin to your local repository:

> git remote add origin git@git-ssh-url-of-your-remote-repository.git

Now add the main repository as a remote repository and merge the current version from it as explained below ("Merging from the main repository").

Working directory

Always change to the source directory before entering any of the following commands

> cd stromx

Pulling from your remote repository

> git pull

Committing changes and pushing them to your remote repository

Optionally, add, delete or move files:

> git add some_file.txt
> git mv a_file.txt b_file.txt
> rm old_file.txt

Commit the changes:

> git commit -a -m"Commit message"

If you want to share the changes or back them up push them to your remote repository:

> git push

Merging from the main repository

First the main repository must be added as the remote main to your local repository. This step has only to be done once for each new local repository:

> git remote add main git://github.com/uboot/stromx.git

Merge the changes:

> git fetch main
> git merge main/master
> ...resolve any merge conflicts...
> git commit -a

As above you can now push the changes to your remote repository using

> git push

Pushing to the main repository

To be able to push to the main repository you have to have write access to main. If this is the case you can set the ssh URL of the main repository as the push URL:

> git remote set-url main --push git@github.com:uboot/stromx.git

Then this command pushes all pending changes to the main repository (i.e. main):

> git push main

Clone this wiki locally