How to use git to edit Worg files?

Table of Contents

{Back to Worg's index}

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, please check it here.

The homepage of the Worg project is here: You can get a read-only clone of the repository with the command:

~$ git clone git://

Since Worg is constantly updated you may want to update your copy of Worg before reading sometimes later. To do so cd into the Worg directory and upgrade your copy of Worg with the command:

~$ git pull

If you want to contribute to Worg, keep reading.

The first time you contribute to Worg

  1. If you don't have a SSH-key, create one.
  2. Send your public key to Bastien asking for push access and wait for confirmation that you have push access.
  3. Install git on your system.
  4. Clone the project somewhere in a working directory:

    ~$ git clone

    If you already have your local clone of Worg obtained via http protocol, you can easily tell your git to remain using http for fetching and git for pushing, by adding to your ~/.gitconfig:

    [url "git://"]
      pushInsteadOf =

    which could come handy later on for any project you clone from

  5. Go to the newly created worg/ directory and edit some files.
  6. If you created files, add them to the git index:

    ~$ git add *.org
  7. Commit changes with the appropriate comment:

    ~$ git commit -a -m "summary comment about all changes"
  8. Push your change to Worg:

    ~$ git push

    The system is designed for immediate updates – if not, it means something is wrong. You should be able to read the error message and see what is wrong, then help with fixing issues. In general the issues are trivial to fix.

The second time you contribute to Worg

  1. Go to your worg/ directory.
  2. Be sure to "pull" the last version of the repository.

    ~$ git pull --rebase
  3. Make some changes. (If you want to learn more about various git workflow, read this page.)
  4. Commit your changes on your local repository:

    ~$ git commit -a -m "summary comment about all changes"
  5. Push your change on the remote repository

    ~$ git push

Going deeper

Getting organized

The Worg TODO file is 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/" "~/git/worg/")

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 global ~/.gitconfig file, or in Worg/.git/config.

Edit it like this:

       name = FirstName LastName
       email =

Now your changes will be filed under your name.

Rebase to avoid merging commits

It's good practice to pull the current version of the repository before making your own additions. But even if you do, someone might make a change while you are working. So it will often be necessary to pull immediately before pushing your new commit. In this situation, if you use git pull directly, then a 'merge commit' will be generated, looking like this:

commit aaaabbbbbbbbbaaaaaaaaabbbbbbbb
Merge: bababa efefefef
Author: Some one <name@domain>
Date:   Wed Nov 24 00:00:01 2010 -0700

    Merge branch 'master' of git+ssh://

That's not a major problem, but it's nice to keep the commit logs free of this stuff. To avoid generating the merge commit, use the --rebase option when pulling:

~$ git pull --rebase

Basically this means that your commit will be put to the top of the stack, as if no one had made any additions while you were working. More advanced git users might make their changes in a personal branch, and then rebase that branch against a freshly pulled master branch before merging it in to master. The end result would be the same as pulling with --rebase.

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 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.

Git usage for people who just want to send patches

See this page.

Emacs' in-built version control system and git

Emacs's VC supports many common git operations, but others, like repository syncing must be done from the command line. For example the Command C-x v v does check in changes in the local and not in the remote repository in contrast to other back ends like svn. It is necessary to do additionally

~$ git push

to sync the change on the remote server.

Documentation from the website (either in its HTML format or in its Org format) is licensed under the GNU Free Documentation License version 1.3 or later. The code examples and css stylesheets are licensed under the GNU General Public License v3 or later.