git-remotes
v1.0.2
Published
Fetch git remotes (A nice parsed version of `git remote -v`)
Downloads
167
Readme
git-remotes
Fetch git remotes (A nice parsed version of git remote -v
).
Runs git remote -v
, grabs the result, parses each remote out of it and produces an array of objects out of it.
Installation
npm install git-remotes
Usage
Require module
var gitRemotes = require('git-remotes');
Retrieving git remotes for the current directory
gitRemotes(function (err, remotes) {
if (err) {
//do something with the error
}
console.log(remotes)
// -> so long as `err` is null,
//`remotes` is always an array with 0 or more objects
// representing git remotes
})
Retrieving git remotes for a specified directory
gitRemotes('./path/to/directory', function (err, remotes) {
// ...
})
Remote objects
remotes
is an array of remote objects that look like:
[
{
name: 'origin'
url: '[email protected]:digitalsadhu/git-remotes.git'
},
//...
]