“ I beleive in open source philosophy and work in the spirit of it, earning a living by it is simply my dream. „

Fighting with svn

by Rok Garbas last modified Aug 08, 2010 06:51 AM
How I use git to make my job with collective (svn) bareble. Sure I'm not the only one trying to fight with this ...
Fighting with svn

Git

In the past I've wrote an article about "How to use git with collective (svn)". This is something like that post, but a little more tricks.

Lets first repeat what we "already know"

1. get first revision

$ svn log https://svn.plone.org/svn/collective/collective.vdexvocabulary
....
------------------------------------------------------------------------
r99681 | garbas | 2009-10-17 01:05:29 +0200 (sáb 17 de oct de 2009) | 2 lines

initial code, no tests ... todavia

------------------------------------------------------------------------
r99678 | garbas | 2009-10-16 21:58:02 +0200 (vie 16 de oct de 2009) | 2 lines

vdexvocabulary initial commit

------------------------------------------------------------------------
$

2. pull out the code from collective

$ svn clone https://svn.plone.org/svn/collective/collective.vdexvocabulary -s -r 99678:HEAD

3. commiting to collective and updating from it

$ cd collective.vdexvocabulary
$ echo "#useless code" >> README.txt
$ git commit
...
$ git svn dcommit
...
$ git svn rebase

    4. tagging for release

    $ git svn tag 1.2

    5. stashing

    $ git stash
    ...
    $ git stash apply

    6. working localy with branches

    $ git branch -r
    1.1 1.2 stripped tags/1.0 tags/1.0rc1 tags/1.0rc2 trunk $ git branch
    * master $ git checkout -b fix-strange-1.2-bug 1.2 $ git branch
    * fix-strange-1.2-bug master $ git checkout master
    $ git merge fix-strange-1.2-bug

    That was quick review of previous commands. For more detailed explanation look at my previous post.

    Working on remote branches

    1. first we create remote branch

    $ git svn branch plone4-compatibility

    2. create local branch from remote branch

    $ git branch -b plone4-compatibility remotes/plone4-compatibility

    voila!. now when you do "git svn dcommit" it will actually commit to remote "plone4-compatibility" branch in collective.

    Show me your .gitconfig

    I'll share my .gitconfig here, I hope I'll get some feedback how even better configure my git.

    [user]
    name = Rok Garbas
    email = rok@garbas.si

    [color]
    diff = auto
    branch = auto
    status = auto
    interactive = auto

    [diff]
    renames = true

    [alias]
    merge = merge --no-ff
    s = status
    d = diff
    ci = commit -v
    cia = commit -v -a
    co = checkout
    l = log
    ll = log -p
    b = branch
    cis = svn dcommit

    [github]
    user = garbas
    token =  XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    [core]
    editor = mvim

    [merge]
    tool = opendiff

    Gitify

    I know I'm not the only one struggling with this question. Since some Tom Lazar was working on his own tool called gitify, which should make usage of git-svn, a little easier. And it actually does. For more you can read here.