-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinitializeGit.js
More file actions
31 lines (29 loc) · 775 Bytes
/
initializeGit.js
File metadata and controls
31 lines (29 loc) · 775 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
var shell = require('shelljs/global');
var prompt = require('prompt');
exports.initialize = function(){
var properties = [
{
name: 'repo',
description: 'What repo do you want to clone'
},
{
name: 'rootBranch',
description: 'What branch do you want to start from'
},
{
name: 'newBranch',
description: 'Name the branch you want to create'
}
];
prompt.start();
prompt.get(properties, function(error, result){
runGit(result.repo, result.rootBranch, result.newBranch);
});
};
function runGit(repo, rootBranch, newBranch) {
exec('git init');
exec('git remote add origin git@github.com:loanlifecycle/' + repo + '.git');
exec('git checkout -b ' + rootBranch);
exec('git pull origin ' + rootBranch);
exec('git checkout -b ' + newBranch);
}