Skip to content

Commit ee9fb8b

Browse files
committed
from branch
1 parent 74ba885 commit ee9fb8b

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

packages/create-cosmos-app/src/utils.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,22 @@ export const cloneRepo = (argv, repo, name) => {
3939
const dir = join(argv.tmpdir || tmpdir(), tempname);
4040
mkdirp(dir);
4141
shell.cd(dir);
42-
shell.exec(`git clone --depth 1 ${repo} ${name}`);
42+
43+
// Initialize the command arguments in an array
44+
let gitCloneArgs = ['git', 'clone', '--depth', '1'];
45+
46+
// Add the branch argument if argv.fromBranch is provided
47+
if (argv.fromBranch) {
48+
gitCloneArgs.push('-b', argv.fromBranch);
49+
}
50+
51+
// Add the repository and name arguments
52+
gitCloneArgs.push.apply(repo, name);
53+
54+
// Join the arguments with spaces to form the command
55+
const gitCloneCommand = gitCloneArgs.join(' ');
56+
57+
shell.exec(gitCloneCommand);
4358
return dir;
4459
}
4560

0 commit comments

Comments
 (0)