]>
git.r.bdr.sh - rbdr/blog/blob - lib/remotes/git.js
1 import { exec
} from 'child_process';
2 import { promisify
} from 'util';
5 // Promisified functions
12 // For the future: actually check if it's a valid git url
16 async
syncUp(remote
, blogDirectory
) {
18 await internals
.exec(`cd ${blogDirectory} && git init -b main`);
19 await internals
.exec(`cd ${blogDirectory} && git add .`);
20 await internals
.exec(`cd ${blogDirectory} && git commit --allow-empty -m blog-sync-up-${Date.now()}`);
21 await internals
.exec(`cd ${blogDirectory} && git push ${remote} main --force`);
24 async
syncDown(remote
, blogDirectory
) {
26 await internals
.exec(`cd ${blogDirectory} && git init -b main`);
28 await internals
.exec(`cd ${blogDirectory} && git checkout .`);
32 await internals
.exec(`cd ${blogDirectory} && git clean . -f`);
33 await internals
.exec(`cd ${blogDirectory} && git pull ${remote} main`);