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

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gitlib/doc/workingcopy.md at main · andreaskienast/gitlib

Expand file tree

/

workingcopy.md

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
47 lines (34 loc) · 1021 Bytes
/

workingcopy.md

Copy path

File metadata and controls

47 lines (34 loc) · 1021 Bytes
Raw
Copy raw file
Download raw file
Outline
Edit and raw actions

Working copy

Working copy is the folder associated to a git repository. In gitlib, you can access this object using the getWorkingCopy on a Repository object:

$repo = new Repository('/path/to/working-dir');
$wc = $repo->getWorkingCopy();

Checkout a revision

You can checkout any revision using checkout method. You can also pass a second argument, which will be passed as argument with -b:

// git checkout master
$wc->checkout('master');

// git checkout origin/master -b master
$wc->checkout('origin/master', 'master');

You can also pass a Reference or a Commit.

Staged modifications

You can get a diff of modifications pending in staging area. To get the Diff object, call method getDiffStaged():

$diff = $wc->getDiffStaged();

Pending modifications

You can get pending modifications on tracked files by calling method getDiffPending():

$diff = $wc->getDiffPending();
You are visitor 01402520 — 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.