GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • gitonomy/gitlib
  • Getting started
  • Opening a repository
  • Creating repositories
  • Revisions
  • Commits
  • Log
  • Trees
  • Blobs
  • Diffs
  • Blame
  • Tags and branches
  • Branches
  • Working copy

This view

  • Original page
  • New address

GeezerVison is showing gitonomy.github.io — Revisions - gitlib

Revision¶

A revision is a name git resolves to a commit: a branch, a tag, a hash, abbreviated or not, HEAD~2, master@{2 days ago}...

To get a revision from a Repository object:

$revision = $repository->getRevision('master@{2 days ago}');

Commit and Reference (a branch, a tag) are revisions too: you can pass them wherever gitlib takes a revision.

Resolve a revision¶

To resolve a revision to a commit:

$commit = $revision->getCommit();

It throws a Gitonomy\Git\Exception\ReferenceNotFoundException when the revision names no commit. A tag, annotated or not, resolves to the commit it points to.

Repository::getCommit() only takes a full hash: use getRevision($name)->getCommit() for anything else.

Getting the log¶

You can access a Log object starting from a revision using the getLog method. This method takes three parameters: paths, offset and limit:

// Returns the 100 last commits
$log = $revision->getLog(limit: 100);

// Returns the 100 last commits changing README.md
$log = $revision->getLog('README.md', limit: 100);

// Skips the 100 last commits
$log = $revision->getLog(null, 100);

The first argument filters on paths: getLog(null, 100) is an offset, not a limit. See Log.

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.