I want to setup a personal wiki in Emacs org-mode. And I want to put this under version control, so that I can see the history of each article, as it evolves.

If I use a single file for my wiki, with top-level headlines denoting articles, how can I track each article individually, using something like Magit?

  • What do you mean by track individually? Would a new branch for each article and patch staging be enough? Using more than one file makes it simple to track changes to individual articles, is there a reason you don't want to do that?
    – Gooby
    Aug 31 '18 at 13:21
  • VC systems track files as units (at least, I don't know of any that interpret the contents of files). The contents of a file are a blob to them, so afaik, no, you cannot do what you want. You will have to have the articles in separate files.
    – NickD
    Aug 31 '18 at 14:15
  • Thanks @Goody. Most of the feedback I have received, when I mention that I want to create a personal wiki in org-mode is to use a single file. What I mean by "track individually" is, I want to be able to narrow in to a single article and then see the change log with say git-timemachine, etc.
    – Adam
    Aug 31 '18 at 15:21
  • thangks @NickD, that's sort-of what I expected. But thought I would check anyway, as most people have recommended a single org file for keeping a personal wiki...
    – Adam
    Aug 31 '18 at 15:22

Mark the subtree in question using e.g. C-c @ and then show the log for just that region using C-c M-g l.

Before you can do that, you have to enable global-magit-file-mode.

  • C-c M-g l is the default binding, I think
    – rpluim
    Sep 13 '18 at 12:01
  • Hey that sounds promising. Do you have all the same tools available for working with subtrees, that you would have with a document? For example, reverting the subtree to an earlier version, without affecting changes to the rest of the file? Or browsing the subtree history with Git Timemachine, or the like?
    – Adam
    Sep 13 '18 at 22:05
  • 1
    No, things won't just work. Splitting things into multiple files helps generic tools a lot in knowing that they deal with different things, it is an abstraction that has existed for decades and that is easy to deal with. When multiple related but distinct things are placed in the same file, then every tool has to be taught how to keep those things apart. "Org section" is just one such thing and expect for Org most software does not know about those.
    – tarsius
    Sep 14 '18 at 8:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.