Skip to content

Instantly share code, notes, and snippets.

@ssddi456
Created December 29, 2014 09:53
Show Gist options
  • Save ssddi456/e82eaf004deb1a7e7995 to your computer and use it in GitHub Desktop.
Save ssddi456/e82eaf004deb1a7e7995 to your computer and use it in GitHub Desktop.
group git repos
var cp = require('child_process');
var fs = require('fs');
var cmd = 'git config --get remote.origin.url';
var jd_git = 'code.jd.com';
fs.readdirSync('.').forEach(function( dir ) {
try{
var stat = fs.statSync(dir);
}catch(e){
console.log( dir );
return;
}
if( stat.isDirectory() ){
cp.exec(cmd,{cwd:dir},function( err, stdout ) {
if( stdout.toString().indexOf(jd_git) != -1 ){
console.log( dir );
console.log( stdout );
}
})
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment