]> sipb.mit.edu Git - ikiwiki.git/blob - doc/rcs/git/discussion.mdwn
web commit by intrigeri: fixed formatting (I will learn to preview before saving...
[ikiwiki.git] / doc / rcs / git / discussion.mdwn
1 ## ikiwiki + git
2
3 <http://fob.po8.org/node/346>
4
5 Here's an early page documenting setting up ikiwiki with git. It shouldn't be
6 this hard anymore. :-) See [[setup]] --[[Joey]]
7
8 ## Migrating from svn to git ##
9
10 I'd like to migrate from svn to git, because git is better in general but also has some nice properties that go well together with my use of ikiwiki.. I only change it myself. I want a single git repo so that my website directory is self-contained so that I don't need to drag around a separate svn repository on my computer. Is it possible to use ikiwiki so that it only uses a git repository in the same dir as all files are stored and edited?
11
12 Otherwise, I hope migrating is just importing the svn repo to git and then setting up ikiwiki to use git. I don't plan to go back to svn after that so git-svn should only do the import.
13
14 ### Solution ###
15 **Basis:** I only use ikiwiki as a wiki compiler. No cgi or anything.
16
17 I imported my svn repo into git with `git-svnimport`. I reconfigured ikiwiki to _not use any rcs_. In `ikiwiki.setup`, I have the git repository as srcdir, and a suitable dstdir. 
18
19 Then, in my git repository, I added this `post-commit` hook to refresh the wiki:
20
21         #!/bin/sh
22
23         # to refresh when changes happen
24
25         BASE="/path/to/base/dir"
26         SETUPFILE="$BASE/ikiwiki.setup"
27         UNDERLAYDIR="$BASE/underlay"
28
29         ikiwiki --refresh --setup "$SETUPFILE" --underlaydir="$UNDERLAYDIR" --verbose   
30
31 Positives:
32
33 * Containment: I only have the above `$BASE` directory to backup: it contains the srcdir and setup files. No external svn repository. This means that suddenly `git` and `ikiwiki` pair into a stand-alone self-contained wiki compiler kit.
34
35 UlrikSverdrup (This is now crossposted to the above mentioned [website][ulrikweb])
36
37 [ulrikweb]: http://www.student.lu.se/~cif04usv/wiki/stuff/git.html
38
39 > Note that while the post-commit hook above may work in some situations, it *will* fail (or at least be suboptimal) for web commits. If you're setting up ikiwiki and git for a wiki that allows web commits, you should use
40 > the repository and hook setups in documented in [[setup]] instead. With that method, you do end up with two separate git repos; but it's fine to only back one of them up. :-) --[[Joey]]
41
42 ## gitmanual
43
44 Main use case I am trying to accomplish: Edit wiki pages offline.
45
46 1. Imagine you're the administrator of the site and you want to checkout the wiki sources to give them some love while on a train journey.
47 2. Or you are writing a complex document and you want to simply use your favourite $EDITOR
48 3. Learn a little more about [git](http://git.or.cz/)
49
50 # Workflow
51
52 ## on webconverger.org aka si.dabase.com aka hendry machine
53
54 Wiki page created with [ikiwiki](http://ikiwiki.info). Example usb.mdwn [usb](http://webconverger.org/usb/)
55
56 ## on monty (my laptop)
57
58     git-clone ssh://si.dabase.com/home/hendry/wikiwc/.git/
59
60 You might want to set some config variables like your email as this [tutorial](http://www.kernel.org/pub/software/scm/git/docs/tutorial.html) describes.
61
62     echo "blah" >> usb.mdwn
63
64 Then to commit:
65
66     git-commit -a -m "added test"
67
68 Send back:
69
70     git push origin
71
72 ## on webconverger.org aka si.dabase.com aka hendry machine
73
74 You should setup the "The git post-update wrapper" in the **ikiwiki.setup** file.
75
76 Then the wiki should be up-to-date! :)
77
78 # Ack
79
80 Thanks to gitte on #git on Freenode and of course joeyh. Have a look at [[rcs/details]].
81
82 ## Too many pages about git?
83 I think it would be a good thing if the various git pages where somehow unified. It seems to me that [[tips/laptop_wiki_with_git]] is currently not so different from [[git]]. Let us see what joeyh thinks about the new git pages, but if this level of detail is to go there, I think it could pretty much include (maybe as sub pages) the info in [[tips/laptop_wiki_with_git]] and [[tips/laptop_wiki_with_git_extended]] --[[DavidBremner]]
84
85 # Does 'push' from the shallow clones work for you? git-clone and git-fetch explicitly state it doesn't...