async function applyDiff() {
const store = new GitStorage({ name: 'your-name', key: env.privateKey });
const repo = await store.findOne({ id: 'repo-id' });
if (!repo) return;
const diffText = `--- a/README.md
+++ b/README.md
@@
-Old line
+New line
`;
const result = await repo.createCommitFromDiff({
targetBranch: 'main',
commitMessage: 'Apply upstream changes',
diff: diffText,
author: { name: 'Automation', email: 'bot@example.com' },
baseBranch: 'main', // optional, matches createCommit options
});
console.log(`Updated commit: ${result.commitSha}`);
}