How to use git to edit Worg files?
Table of Contents
What is git?
git is a fast version control system that lets you collaborate on a project. For details on how to use git, go and read the git tutorial. For details on the public git repository, go and read the about page of http://repo.or.cz/.
The homepage of the Worg project is here: http://repo.or.cz/w/Worg.git You can get a read-only clone of the repository with the command:
~$ git clone http://repo.or.cz/r/Worg.git
If you want to contribute to Worg, keep reading.
The first time you contribute to Worg
- If you don't have a SSH-key, create one.
- Register a new account on the git public repository.
- Drop an email to Bastien mentioning your username on repo.or.cz
- Install git on your system.
-
Clone the project somewhere in a working directory:
~$ git clone git+ssh://repo.or.cz/srv/git/Worg.git
-
Go to the newly created
Worg/directory and edit some files. -
If you created files, add them to the git index:
~$ git add *.org
-
Commit changes with the appropriate ChangeLog:
~$ git commit -a -m "My changelog"
-
Push your change to Worg:
~$ git push
This stage didn't work for me, instead I had to add a remote like so:
~$ git remote add public git+ssh://<UserName>@repo.or.cz/srv/git/Worg.git
Where <UserName> is the username you supplied repo.or.cz. Then do a:
~$ git push public
The second time you contribute to Worg
-
Go to your
Worg/directory. - Be sure to "pull" the last version of the repository.
- Make some changes.
-
Commit your changes on your local repository:
~$ git commit -a -m "My ChangeLog"
-
Push your change on the remote repository
~$ git push
Getting organized
The Worg TODO file is worg-todo.org. If you are a Worg zealot, maybe you
want to add this file to the list of your agenda files. For example, here
is my org-agenda-files variable:
(setq org-agenda-files '("~/org/bzg.org" "~/git/Worg/worg-todo.org")
I have an agenda custom command for checking tasks that are assigned to me:
(org-add-agenda-custom-command '("W" tags "Owner=\"Bastien\""))
The next time someone assigns a task for me, it will appear in my Worg agenda view.
Register your changes under your name
Information regarding your name can be stored in your ~/.gitconfig file.
Edit it like this:
[user]
name = Your Name Goes Here
email = you@yourdomain.example.com
Now your changes will be filed under your name.
Dealing with line endings
Unix, Windows and Mac all have different conventions for marking the end of a line. This might lead to problems when editing the same file across platforms. Github advises Linux users to automatically convert all external files to LF on committing (see http://help.github.com/dealing-with-lineendings) by setting:
$ git config --global core.autocrlf input
For Worg, this is the wrong solution, since there are already files with both end of line conventions in the repository. Instead tell git locally not to convert files by setting:
$ git config core.autocrlf false
Of course you have to be careful not to save Windows files as Unix files or vice versa, since this would lead to large and confusing diffs. This should not be a problem with Worg as
- one rarely edits other people's files anyway, and
- Emacs can deal with end of line conventions transparently.
How Worg publishes itself as HTML?
The server behind http://orgmode.org website takes care of publishing
Worg into HTML. This is done in two steps: the first step is to
pull the Worg directly on the server, the second one is to publish the
last version of Worg on the website. Both steps are cron'ed every
hour, the first one at 1:00, 2:00, etc. and the second one at 1:30,
2:30.
So for example, if you push a change in Worg at 0:58am, this will be pulled on the server at 1am and will appear on the website at 1:30am.
Here is the detailed recipe:
-
Configure your
~/.emacs.elto know about your publishing projects (more information on publishing here and here) -
Use
(setq org-export-htmlize-output-type 'css)in ~/.emacs.el(Do
C-h v org-export-htmlize-output-typefor more information about this. AlsoC-h v org-export-htmlize-generate-cssmight help.) -
Create
~/bin/pull-worg.shcontaining this script:#!/bin/bash # unless this is already done elsewhere: export PATH=$PATH:/home/you/bin/ # go to the place where you pull Worg cd /home/you/git/Worg/; # pull Worg /home/you/bin/git-pull
-
Create
~/bin/pull-worg.shcontaining this script:#!/bin/bash # Adapt it to point at your emacs executable /home/you/bin/emacs23 --batch -l ~/.emacs.el -f org-publish-all
-
Cron the two scripts to run every hour, not at the same time
0 * * * * /home/you/bin/pull-worg.sh >> /dev/null 2>&1 30 * * * * /home/you/bin/publish-worg.sh >> /dev/null 2>&1
- Sit and do something else while your Org repository is automagically exported to HTML