Wiki – File versioning

I am building a wiki-like website, and am wondering how to implement the file versioning to create articles history. I would like to be able, when someone edits a file, to be able to display which parts were edited, and to revert back to a previous file if necessary.

EDIT:
Thank you for your responses. I started to go through them, and then I realized my post was not very precise. So I may add that I am using Java as a development language (Groovy through Grails to be precise). Also, the application I am building is not only a Wiki. It does plenty of other stuff but some parts should be editable by several users. So I am looking for the best candidate for that particular job.

  • Git detects changed files that are actually byte-identical
  • Am I doing it wrong? Merging SVN changes from trunk into a git branch. Using merge --squash
  • How can I add another repository in git?
  • How to merge my local uncommitted changes into another Git branch?
  • what is dereference in the context of git show-ref -d
  • How to update git repos automatically?
  • git impossible to push after add
  • What is the difference between git commit and git commit-tree
  • How to change author email at commit time with hooks
  • How do I find the Git commit where some code was removed?
  • How to specify ppk for Git sync operations?
  • Is there workflow in git to share same file in multiple branch?
  • 3 Solutions collect form web for “Wiki – File versioning”

    I would just look at how ikiwiki or gitit are implemented (Perl and Haskell, respectively) as both are able to use Git as a backend.

    As to ikiwiki (I’m using it for my intranet wiki at work) it saves page sources (wiki formatting) as plain files, and after each save (or git push from the outside) it “compiles” the site to a set of static pages. It uses make-style approach for compiling the site though so ony the changed pages are rebuilt.

    Speaking of Git, what you need is already implemented in the forms of git blame and git checkout.

    Even though you could use those commands to get the job done, you would probably be better off with libgit2 which is basically all the functionality you need, but as a library instead of executables.

    You may want to have a look at Gollum, Github’s git-powered wiki engine.

    Git Baby is a git and github fan, let's start git clone.