org-web.org: added Olivier Berger's personal homepage.
[Worg.git] / worg-git.org
blobdf22ca1ab307932edb113ba0e78482c3cf5a0a1e
1 #+STARTUP:    align fold nodlcheck hidestars oddeven lognotestate
2 #+SEQ_TODO:   TODO(t) INPROGRESS(i) WAITING(w@) | DONE(d) CANCELED(c@)
3 #+TITLE:      How to use git to edit Worg files?
4 #+AUTHOR:     Worg people
5 #+TAGS:       Write(w) Update(u) Fix(f) Check(c)
6 #+EMAIL:      bzg AT altern DOT org
7 #+LANGUAGE:   en
8 #+PRIORITIES: A C B
9 #+CATEGORY:   worg
10 #+OPTIONS:    H:3 num:nil toc:t \n:nil @:t ::t |:t ^:t -:t f:t *:t TeX:t LaTeX:t skip:nil d:(HIDE) tags:not-in-toc
12 [[file:index.org][{Back to Worg's index}]]
14 * What is git?
16 [[http://git.or.cz][git]] is a fast version control system that lets you collaborate on a project.
17 For details on how to use git, go and read the [[http://www.kernel.org/pub/software/scm/git/docs/gittutorial.html][git tutorial]].  For details on
18 the public git repository, go and read the [[http://repo.or.cz/about.html][about page]] of
19 http://repo.or.cz/.
21 The homepage of the Worg project is here: http://repo.or.cz/w/Worg.git
22 You can get a read-only clone of the repository with the command:
24    : ~$ git clone http://repo.or.cz/r/Worg.git
26 Since Worg is constantly updated you may want to update your copy
27 of Worg before reading sometimes later.  To do so cd into the
28 Worg directory and upgrade your copy of Worg with the command:
30    : ~$ git pull http://repo.or.cz/r/Worg.git
34 If you want to contribute to Worg, keep reading.
36 * The first time you contribute to Worg
37   :PROPERTIES:
38   :CUSTOM_ID: contribute-to-worg
39   :END:
42 1. If you don't have a SSH-key, [[file:worg-git-ssh-key.org][create one]].
44 2. Register a [[http://repo.or.cz/reguser.cgi][new account]] on the git public repository (don't forget to
45    copy paste your public SSH key from =~/.ssh/id_rsa.pub= to the
46    registration form.)
48 3. *Drop an email to* [[mailto:bzg%20AT%20altern%20DOT%20org][Bastien]] mentioning your username on repo.or.cz.
50 4. Install git on your system.
52 5. Clone the project somewhere in a working directory:
54    - If your user name in the shell is the same as the =Login=
55      [[http://repo.or.cz/reguser.cgi][registered at repo.or.cz]]:
57      : ~$ git clone git+ssh://repo.or.cz/srv/git/Worg.git
59    - else add the =Login= [[http://repo.or.cz/reguser.cgi][registered at repo.or.cz]] to <UserName>:
61      : ~$ git clone git+ssh://<UserName>@repo.or.cz/srv/git/Worg.git
63 6. Go to the newly created =Worg/= directory and edit some files.
65 7. If you created files, add them to the git index:
67    : ~$ git add *.org
69 8. Commit changes with the appropriate comment:
71    : ~$ git commit -a -m "summary comment about all changes"
73 9. Push your change to Worg:
75    - If your user name in the shell is the same as the
76      =Login= [[http://repo.or.cz/reguser.cgi][registered at repo.or.cz]]:
78      : ~$ git push
80    - else add the =Login= [[http://repo.or.cz/reguser.cgi][registered at repo.or.cz]] to <UserName>:
82      : ~$ git remote add public git+ssh://<UserName>@repo.or.cz/srv/git/Worg.git
84      Then do a:
86      : ~$ git push public
88      If you get a git error message looking like the one at the bottom
89      of this page, then this means that you've forgotten to drop a mail
90      to Bastien (see step 3).
92 * The second time you contribute to Worg
94 1. Go to your =Worg/= directory.
96 2. Be sure to "pull" the last version of the repository.
98 3. Make some changes.  (If you want to learn more about various git
99    workflow, read [[file:worg-git-advanced.org][this page]].)
101 4. Commit your changes on your local repository:
103    : ~$ git commit -a -m "summary comment about all changes"
105 5. Push your change on the remote repository
107    : ~$ git push
109 * Going deeper
110 ** Getting organized
112 The Worg TODO file is =worg-todo.org=.  If you are a Worg zealot, maybe you
113 want to add this file to the list of your agenda files.  For example, here
114 is my =org-agenda-files= variable:
116   : (setq org-agenda-files '("~/org/bzg.org" "~/git/Worg/worg-todo.org")
118 I have an agenda custom command for checking tasks that are assigned to me:
120   : (org-add-agenda-custom-command '("W" tags "Owner=\"Bastien\""))
122 The next time someone assigns a task for me, it will appear in my Worg
123 agenda view.
125 ** Register your changes under your name
127 Information regarding your name can be stored in your ~/.gitconfig file.
129 Edit it like this:
131 : [user]
132 :        name = FirstName LastName
133 :        email = you@yourdomain.example.com
135 Now your changes will be filed under your name.
137 # I'm not sure this is useful at all:
139 ** Dealing with line endings
141 Unix, Windows and Mac all have different conventions for marking
142 the end of a line. This might lead to problems when editing the
143 same file across platforms. Github advises Linux users to
144 automatically convert all external files to LF on committing (see
145 [[http://help.github.com/dealing-with-lineendings]]) by setting:
146 : $ git config --global core.autocrlf input
147 For Worg, this is the wrong solution, since there are already
148 files with both end of line conventions in the repository.
149 Instead tell git locally not to convert files by setting:
150 : $ git config core.autocrlf false
151 Of course you have to be careful not to save Windows files as
152 Unix files or vice versa, since this would lead to large and
153 confusing diffs. This should not be a problem with Worg as
154   - one rarely edits other people's files anyway, and
155   - Emacs can deal with end of line conventions transparently.
157 ** Git usage for people who just want to send patches
159 See [[file:worg-git-advanced.org][this page]].
161 * How Worg publishes itself as HTML?
163   The server behind http://orgmode.org website takes care of publishing
164   Worg into =HTML=. This is done in two steps: the first step is to pull
165   the Worg directly on the server (cron'ed every 20 minutes, starting at
166   00:00), the second one is to publish the last version of Worg on the
167   website (cron'ed every 20 minutes, starting at 00:10).
169   So for example, if you push a change in Worg at 00:37, this will be
170   pulled on the server at 00:40 and will appear on the website at 00:50.
172   The output of both cron jobs are here: 
173   
174   - http://orgmode.org/worg/pulling.txt
175   - http://orgmode.org/worg/publishing.txt
177   Here is the detailed recipe:
179   1. Configure your =~/.emacs.el= to know about your publishing projects
180      (more information on publishing [[http://www.gnu.org/software/emacs/manual/html_node/org/Publishing.html][here]] and [[file:org-tutorials/org-publish-html-tutorial.org][here]])
182   2. Use =(setq org-export-htmlize-output-type 'css)= in ~/.emacs.el
184      (Do =C-h v org-export-htmlize-output-type= for more information
185      about this.  Also =C-h v org-export-htmlize-generate-css= might
186      help.)
188   3. Create =~/bin/pull-worg.sh= containing this script:
190      #+BEGIN_SRC sh-mode
191      #!/bin/bash
193      # unless this is already done elsewhere:
194      export PATH=$PATH:/home/you/bin/
196      # go to the place where you pull Worg
197      cd /home/you/git/Worg/;
199      # pull Worg
200      /home/you/bin/git-pull
201      #+END_SRC
203   4. Create =~/bin/publish-worg.sh= containing this script:
205      #+BEGIN_SRC sh-mode
206      #!/bin/bash
208      # Adapt it to point at your emacs executable
209      /home/you/bin/emacs23 --batch -l ~/.emacs.el -f org-publish-all
210      #+end_src
212   5. Cron the two scripts to run every hour, not at the same time
214      #+BEGIN_SRC generic-mode
215      0 * * * * /home/you/bin/pull-worg.sh >> /dev/null 2>&1
216      30 * * * * /home/you/bin/publish-worg.sh >> /dev/null 2>&1
217      #+END_SRC
219   6. Sit and do something else while your Org repository is
220      automagically exported to HTML
221 * COMMENT Anonymous editing through the "mob" user/branch
223 If you don't want to register a new account on =repo.or.gz= but still
224 want to suggest modifications on Worg, you can do this by editing the
225 "mob" branch of Worg.  For details about the =mob= user, check [[http://repo.or.cz/mob.html][this
226 webpage]] on repo.or.cz
228 This branch is usually empty, since interesting changes are quickly
229 merged into the master branch.  But it is important to make sure that
230 you pull all changes in any existing =mob= branch before trying to push
231 yours.
233 1. Clone the Worg project as the =mob= user:
235    : ~$ git clone git+ssh://mob@repo.or.cz/srv/git/Worg.git
237 2. Check out the "mob" branch to avoid conflicts between the =mob=
238    branch that you will soon create and any existing =mob= branch:
240    : ~$ git checkout origin/mob
242    You should get this warning:
244    : Note: moving to "origin/mob" which isn't a local branch
245    : If you want to create a new branch from this checkout, you may do so
246    : now or later) by using -b with the checkout command again. Example:
247    : git checkout -b <new_branch_name>
249    Don't worry.
251 3. Create a new branch named =mob= from this checkout:
253    : ~$ git checkout -b mob
255 4. Edit the files, add new files (=git-add=) and commit (=git-commit=)
256    them as usual.
258 5. Push the =mob= branch into the Worg remote directory:
260    : ~$ git push origin mob
262 You're done!
264 # FIXME:
266 # What if two people edit Worg at the same time?
267 # bzg [2009-07-15 mer]: No problem.  Just try to push and resolve
268 # conflicts if any.
270 # Can I have private sections in Worg?
271 # bzg [2009-07-15 mer]: Sure.  Just add an :AUTHOR: property in
272 # the property drawer.
274 * Example error message
276 Git error message, when you don't have push permissions to Worg:
278        : % git push
279        : Counting objects: 5, done.
280        : Delta compression using up to 2 threads.
281        : Compressing objects: 100% (3/3), done.
282        : Writing objects: 100% (3/3), 463 bytes, done.
283        : Total 3 (delta 2), reused 0 (delta 0)
284        : error: unable to create temporary sha1 filename ./objects/64: File exists
285        : 
286        : fatal: failed to write object
287        : error: unpack failed: unpacker exited with error code
288        : To git+ssh://myUserName@repo.or.cz/srv/git/Worg.git
289        :  ! [remote rejected] master -> master (n/a (unpacker error))
290        : error: failed to push some refs to
291        :   'git+ssh://myUserName@repo.or.cz/srv/git/Worg.git'