Friday, 14 December 2012

Notice dev cycle

Some of you will know Notice and some may wonder how it is developed. You may also wonder how to connect distributed versions of git so that you can just push changes between clones.

I have a desktop, a server and github.

desktop Notice branches:


  arch
  client_012
  client_013
  github
* master

server Notice branches:

  master
  github
* live

github Notice branches:

 * master

What are these and how do they link? The desktop master is where I do all of the development. Anything that can go public gets checked out into github and pushed to the master branch on github. If I have a client that needs a copy of Notice then I fork the master branch, ( with my internal code for that customer as the branch name); add their logos and changes and link that to their server, (more on that shortly.)

Rather unsurprisingly I use Notice for my own production server. The desktop master branch is linked to the server master branch. Any time I issue

alexx@desktop:/v/www/s/github/Notice$ git push

github is updated with the github branch and
the server is updated with the master branch. It does not go live.

Over to the server. The sysadmin, (a quick wardrobe change via ssh) on the server merges in the master branch, or if that will break things, (this is production) then cherry-picks or 

git co master -- single/files or/more

The configs

on the desktop:

# cat ~Notice/.git/config

[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
[remote "server"]
        url = ssh://alexx@server.alexx.net:22/var/www/sites/Notice
        fetch = master:master
        pull = master:master
       push = master:master
[remote "origin"]
        url = git@github.com:alexxroche/Notice.git
        fetch = master:github
        pull = master:github
       push = github:master
[user]
        name = Alexx Roche
        email = your_email@example.com
[branch "github"]
        remote = origin
        pull = master:github
        push = refs/heads/github:refs/remotes/origin/master
 [branch "master"]
        remote = server
        pull = master:master
        push = refs/heads/master:refs/remotes/ns0/master
       

# This shows that push can be local-branch:remote-branch or the more complicated git style

on the server:

[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
[remote "origin"]
    url = git@github.com:alexxroche/Notice.git
    fetch = master:github
    pull = master:github
    push = github:master
[user]
    name = Alexx Roche
    email = your_email@example.com
[branch "github"]
    remote = origin
    pull = master:github
    push = refs/heads/github:refs/remotes/origin/master
    #merge = refs/heads/github

Github has the public ssh keys from my desktop notice account. 

Now this may be because I came from a cvs/svn world, but without a central repo, (like gitolite) it can feel hard to define which is the authoritative version. (Also with the ease of branching and cloning I ended up with over 25 copies of Notice on four computers and two usb flash-drives, each with a few changes and some of the copies.) Now that I've merged them all back together, I've got my version control under control, and I'm getting more used to the idea that the definitive version depends upon which branch you are talking about. If you think that I'm going about this in the wrong way or know of any improvements then explain in the comments. 

No comments:

Post a Comment

About this blog

Sort of a test blog... until it isn't