MCPcopy Create free account
hub / github.com/6174/comflowyspace / forceUpdateRepo

Function forceUpdateRepo

apps/node/src/modules/utils/git-repo.ts:24–36  ·  view source on GitHub ↗
(repoPath: string)

Source from the content-addressed store, hash-verified

22}
23
24async function forceUpdateRepo(repoPath: string): Promise<void> {
25 const git: SimpleGit = simpleGit(repoPath);
26
27 try {
28 // 强制拉取远程仓库的变化
29 await git.fetch(['--all']);
30 await git.reset(['--hard', 'origin/master']); // 可根据实际情况更改分支
31
32 logger.info('Repository forcefully updated.');
33 } catch (error: any) {
34 logger.error('Error updating repository:' + error.message + ":" + error.stack);
35 }
36}
37
38// 示例使用
39const repoPath = '/path/to/your/repo';

Callers 1

updateRepoFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected