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.