diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/DVCUtils.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/DVCUtils.java index e948666e..edebbfad 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/DVCUtils.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/DVCUtils.java @@ -537,6 +537,8 @@ public class DVCUtils { fetchCommand.setCredentialsProvider(credentialsProvider).call(); } } + + //强制切换分支 public void gitCheckoutBranch(String localPath, String branchName) throws IOException, GitAPIException { FileRepositoryBuilder builder = new FileRepositoryBuilder(); Repository repository = builder.setGitDir(new File(localPath, ".git")) @@ -546,7 +548,7 @@ public class DVCUtils { try (Git git = new Git(repository)) { CheckoutCommand checkoutCommand = git.checkout(); - checkoutCommand.setName(branchName).call(); + checkoutCommand.setName(branchName).setForce(true).call(); } } @@ -599,9 +601,9 @@ public class DVCUtils { runCommand(command, localPath); } - // 更新的 dvcPull 方法 + // 强制刷新 dvcPull 方法 public void dvcPull(String localPath) throws Exception { - String command = "dvc pull -v"; + String command = "dvc pull --force"; runCommand(command, localPath); }