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.

  • how to discard git local branch changes?
  • Set git config values for all child folders
  • How to retrieve all object IDs?
  • Can i use git version control application without github?
  • How to prevent git merge to merge a specific file from trunk into a branch and vice versa
  • Git show all branches (but not stashes) in log
  • How do I obtain a list of files that changed from svn over a date range?
  • Git: Import commits from a repo to another repo
  • Git - Permission denied (publickey)
  • cant fix bad object HEAD error with git status
  • Git: created new branch from a wrong branch
  • clojure and leiningen - using a git repository as dependency
  • 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.