node package manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

git-working-directory

NPM version Build Status Dependency Status

Find the working directories of a git repository on a local machine.

Install

$ npm install --save git-working-directory

Usage

var git-working-directory = require('git-working-directory');
 
git-working-directory('adamzr', 'git-working-directory', function(workingCopies){
  console.log(workingCopies);// Will print an array of absolute file paths to working copies of a given git repository 
});

We search all sub-directories of your home directory looking for all git repositories, then we check the remote origin URL in each one to check if it is a working copy of the repository you are looking for. workingCopies will be an empty array if no working copies are found. This function can take a while to complete if you have a large home directory.

License

MIT © Adam Richeimer