Don't understand german? Read or subscribe to my english-only feed.

git-server for the poor: git-update-server-info, rsync and remote repository

I was working on the integration of live-initramfs for grml in the last few days. As the Debian maintainers of live-initramfs switched from svn to git and I contributed several patches I had to deal with git as well. Thanks to my personal VCS hero gebi I learned some cute tricks for working with git. One very nice tip is the ‘git-server for the poor’, which is pretty simple to use and set up as soon as you know what to do. ;-) As there isn’t that much documentation regarding this issue on the net yet I’ll provide the necessary steps here:

On the server side (where you are running a webserver) you just need a directory for serving via HTTP:

% mkdir -p /var/www/grml/git/live-initramfs.git

On the client side check out the original repository, create a branch, edit what you want to and finally put it on the server so upstream can grab it:

% git clone git://git.debian.org/git/users/daniel/live-initramfs.git
% cd live-initramfs
% git checkout -b cool_new_feature
Switched to a new branch "cool_new_feature"
% $EDITOR $FILE(S)_YOU_WANT_TO_CHANGE
% git commit -a
% git-update-server-info
% rsync -az .git/* server:/var/www/grml/git/live-initramfs.git/

Now upstream (or you) can work with the remote git repository in the local repository and can refer to it through a name:

% git remote add prokop http://grml.org/git/live-initramfs.git
% git remote update

Let’s checkout what we have on the remote repository available:

% git remote show prokop
* remote prokop
  URL: http://grml.org/git/live-initramfs.git
  Tracked remote branches
    cool_new_feature master
% git diff master..prokop/cool_new_feature

Finally do with it whatever you like, for example:

% git merge master prokop/cool_new_feature
... or ...
% git merge $COMMIT_ID
... or ...
% git co master
% git merge prokop/cool_new_feature
... or ...
% git checkout -b my_test_branch prokop/cool_new_feature
... or ...
% git-merge
... or ...
% git-cherry-pick
... or ...

This process might be very handy for working together with upstream (hi, panthera :-))

JFTR: I’m tracking useful ressources for working with git at my del.icio.us page.

One Response to “git-server for the poor: git-update-server-info, rsync and remote repository”

  1. Daniel Baumann Says:

    because you referenced it…

    I had to reset the git repo after the 1.99.2-1 upload; so your previous contributions are only in the changelog (and not in the commit messages):

    http://git.debian.org/?p=users/daniel/live-initramfs.git;a=blob;f=docs/ChangeLog;h=ecd8a0a11c5a4d34b5bfbbeba488e0ee09fab68e;hb=HEAD

    everything after 1.99.2-1 will thus now have a proper generated changelog (wrt/ the three changelogs you mentioned).