Mailinglist Archive: opensuse-buildservice (260 mails)

< Previous Next >
[opensuse-buildservice] The move to git: what changes for you
  • From: Stephan Kulow <coolo@xxxxxxx>
  • Date: Fri, 4 Dec 2009 11:03:46 +0100
  • Message-id: <200912041103.46955.coolo@xxxxxxx>

The build service is in git now and while svn was simply and easy,
git is powerful and more complex. The good news is that the things
most of you do are easy with git too. If you head to the power usages,
you might need more documentation than this mail.

So let me first summarize the basic ideas in svn and git:

SVN has one central server and only admins have access to the repository,
developers need to access it through a client for almost everything. This
includes creating diffs, checking out branches, creating branches, ...
SVN also has no specific concept about branches, everything in there are
directories, you copy away trunk into another directory (common practise
is a subdirectory below /branches, but that's just convention) and then
you need to track patches between trunk and the branches your own. There
are tools to help with that though. The working copy is a 1:1 representation
of one directory of the SVN server. You either have uncommited changes
or they are on the server too.

GIT has no central server, everyone has full access to the repository and
the clients will mainly only exchange their changes. Of course you can
put these repositories on servers so it's easier for exchange between
several people - that's what (and many others provide).
All other actions are done in the local repository of the single developer,
you create diffs, checkout branches, commit, create branches, merge branches -
all in _your_ repository. Unless you decide to "push" these changes into
another repository or "pull" from another repository it's all for yourself.
The working copy always contains the full repository (you can limit the
download to certain branches and history depth though).

So there is a fundamental difference between these two that _is_ a cultural
shock - no doubt. But this cultural difference is basically what the whole
openSUSE project is all about: SVN is "group of people develops on their
server", GIT is "everyone is free to join, no-one has more rights than
the other to develop". (You might disagree and I'm oversimplifying)

Of course the repository on is protected and not everyone
can push to _that_ repository directly without review. But with svn you
have to collect patches on your own and keep sending them, with git(orious)
you can clone the build-service repository, develop on your own annotating
every change you did (keeping track on your own development history) and
once you're satisfied you push it as "merge request". This is _very_ similiar
to what you do with osc and devel branches. So this should not be new to you.

So how do you start? Let me take osc as an example.

git clone git://
cd osc
./ -h

git pull

Commit to your repository:
git commit -a # -a for all files

Upload your changes:
git push

Show the last commit:
git show HEAD

Show all branches:
coolo@desdemona#osc>git branch -a
* master
remotes/origin/HEAD -> origin/master

Checkout a branch:
# note that this is all locally, no server contacted
git checkout -t origin/jw

Merge another branch (the short way):
git merge origin/master

Merge another branch (the long way):
coolo@desdemona#osc>git merge origin/jw
Auto-merging NEWS
CONFLICT (content): Merge conflict in NEWS
coolo@desdemona#osc>eclipse NEWS
coolo@desdemona#osc>git diff NEWS # see diffs against merge point
coolo@desdemona#osc>git add NEWS # mark as resolved
coolo@desdemona#osc>git commit # commit manual merge

Note the "origin", every remote repository has a name. There can be more than
one. As you can clone repositories, you can also register more than one
repository "clone" and then merge the changes locally in your repository and
push it to a 3rd repository - as I said in the beginning: git is powerful
and complex. So my suggestion would be: start with simple things and get used
to the commands. You can also clone the repositories on gitorious and play
around as much as you like in those clones - they can be discarded in a second
if something went wrong :)

Greetings, Stephan
To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse-buildservice+help@xxxxxxxxxxxx

< Previous Next >