- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试做一些可能愚蠢的事情,我需要你的帮助来澄清事情。
有人问我如何处理固件的版本,所以我告诉他 git、svn 以及这两个东西附带的所有 GUI。但这并不完全是他所需要的。他是唯一负责这个固件的人,他只需要处理不同的版本。例如,如果他在 v3 上工作,他希望能够随时返回到以前的版本。同时,他希望像使用“git diff”命令一样查看修改。
为了给他想要的程序,我正在尝试编写一个java程序(也许这不是最好的选择?),它将使用他需要的一些git命令(commit,diff,reset,...)这也将提供他需要的额外功能。
如果您有建议或者我错过了什么,请告诉我。
现在,关于java程序:
我在使用“git diff”命令时遇到了一些问题。在 shell 中,没问题,我得到了所有的红线和绿线,但在 java 控制台中,没有显示任何内容。您还应该知道“git status”(例如)命令在 shell 和 java 控制台中都可以完美运行。
这是我的代码:
Scanner keyboard = new Scanner(System.in);
System.out.println("enter a git command");
String command = keyboard.nextLine();
keyboard.close();
File execute = new File("C:/.../MyGitRepository");
Process process = Runtime.getRuntime().exec(command, null, execute);
Scanner s = new Scanner(process.getInputStream());
StringBuilder text = new StringBuilder();
while (s.hasNextLine()) {
text.append(s.nextLine());
text.append("\n");
}
s.close();
int result = process.waitFor();
System.out.printf("Process exited with result %d and output %s%n", result, text );
使用“git diff”命令,我得到这个:
enter a git command
git diff
通过“git status”命令我得到这个:
enter a git command
git status
Process exited with result 0 and output On branch master
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: MyFile1.xml
modified: MyFile2.xml
modified: MyFile3.xml
...
感谢您的帮助!
最佳答案
如果相关人员之前没有任何任何 VCS 经验,那么基于 Git 是最糟糕的选择
对于
he wants to be able to come back to the former version at any time. Simultaneously, he wants to see the modifications
这是任何 SCM 的自然任务,他可以选择这个(“任何”)具有良好但不过分臃肿的 GUI 的 VCS(对于线性历史,甚至 SVN|TortoiseSVN 将是不错的选择)
从 Java 调用 Git 确实是变态
关于java - 使用java程序进行版本控制,使用DOS命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27816718/
在MS-DOS中,如果输入dir *.pdf,我将在目录中获取所有PDF文件。除了PDF文件,有什么方法可以获取所有内容?像dir !*.pdf一样? 谢谢! 最佳答案 我认为findstr有一个/v
我们如何在 DOS 中实现递归目录列表? 我正在 DOS 中寻找一个命令或脚本,它可以为我提供类似于 Unix 中的 ls -R 命令的递归目录列表。 最佳答案 您可以使用: dir /s 如果您需要
当我使用 ren "C:\folder\file""C:\folder\file.txt" 出现错误“命令的语法不正确。” 但是如果我 CD 到文件夹并使用 ren "file""file.txt"
比如,我能不能做 回显 3 + 5 并得到 8? 是否可以使用日期进行计算? 最佳答案 您可以使用set/a 来计算数学表达式: set /a x=3+5 echo %x% 编辑:这是一行: @for
我正在寻找一个 DOS 脚本来删除根目录中的所有文件和子目录,但根目录中的一组批处理文件 (*.bat) 除外。任何 DOS 运动员都知道一种简单的方法来做到这一点? 更新 谢谢大家的帮助。这就是我现
如何在目录及其子目录中搜索文件并以简洁的格式显示文件名及其创建时间。 我尝试了dir sam.csv/b/s/a-d 但是不起作用。 输出应该如下所示 c:\Data\Sam.txt 10/10/20
我有一个在并发 DOS 3.1 上运行的软件,我使用 QEMU 5.1 对其进行模拟。 在此程序中,有多个打印数据的选项。问题是到达我的主机的数据与发送的数据不对应。 启动qemu的命令: qemu-
我有一个在并发 DOS 3.1 上运行的软件,我使用 QEMU 5.1 对其进行模拟。 在此程序中,有多个打印数据的选项。问题是到达我的主机的数据与发送的数据不对应。 启动qemu的命令: qemu-
在 C 中,我如何写入特定的内存位置,例如视频内存 b800,在 DOS 下(真正的 DOS,MS DOS 6.22) 我知道 C 没有内置任何东西可以做到这一点,但可能有一些特定于平台的东西,例如可
我有一个大约 15 年前购买的非常古老的应用程序,它由 5 个 .exe 文件组成,用于存储患者的个人资料和信息。问题是该应用程序被编程为在特定计算机上运行。 由于我对破解知之甚少,我尝试使用 win
这个问题已经有答案了: How to redirect stderr to null in cmd.exe (1 个回答) 已关闭 4 年前。 我想抑制在 DOS 下运行的脚本的输出,类似于 *nix
我想从 MATLAB 在 dos 中执行一个批处理文件,并立即将控制权返回给 MATLAB。但是,我想在不打开 dos 窗口的情况下执行此操作(或者,至少,让 dos 窗口在最后消失)。 如果我这样格
最初... 我在 10 年前(大学)开始用 C 编程。我使用的 IDE 是 Turbo C++ IDE。 我所有的 c 程序都是 16 位的。 内存模型:巨大。 图形:4 位(16 色)。 图形驱动:
关闭。这个问题是off-topic .它目前不接受答案。 想改善这个问题吗? Update the question所以它是 on-topic对于堆栈溢出。 11 年前关闭。 Improve this
我需要一个批处理文件中的脚本,当我运行它时,它会将我昨天的日期放入一个变量中。包括 3 月 1 日等条件(根据年份可能是 2 月 28 日或 29 日) 最佳答案 假设您的意思是 ms-dos 批处理
我有一个可以做几件事的批处理文件。如果其中一个失败,我想退出整个程序。例如: @echo off type foo.txt 2>> error.txt >> success.txt mkdir bob
我正在尝试编写一个批处理脚本,将多个 css 文件合并到一个文件中。到目前为止,我已经想出了这个...... # Set start folders & files set fn1=filename.
我有不同的文件夹,例如:a、b、c 等,每个文件夹都有不同的文件,例如:x、y、z 等。 文件 x,y,z 位于每个文件夹中。有没有办法使用单个命令从不同文件夹复制每个文件?我希望结果是所有文件夹中的
我需要获取命令行输出的第一行而不是所有行,例如,如果我给 C:\Temp> dir 我只需要显示第一行, 11/15/2012 06:58 PM
如何使用 dos 批处理文件命令将日期设置为当前日期。 最佳答案 如果您需要在批处理文件中使用当前日期,则变量 %date% 具有当前日期: echo %date% 23/02/2010 它使用您计算
我是一名优秀的程序员,十分优秀!