我正在使用Process
from运行 git 命令cmd.exe
,一切正常,现在我正在尝试重新设置分支并想知道重新设置是否成功,然后想在git push
下一步运行命令。
有什么方法可以知道 git rebase 是否成功,而不会从 的响应消息中产生冲突Process
?
因为当它成功时,它会给出这个响应Successfully rebased and updated refs/heads/qa.
我检查了这个问题 是否有某种“git rebase --dry-run”,它会提前通知我冲突?
答案说,如果它是一个非零响应,这意味着它不成功,但 rebase 没有以 0/1 格式给出响应,它会返回文本。
我的代码是这个
ProcessStartInfo procStartInfo = new ProcessStartInfo("cmd", "/c git rebase master");
procStartInfo.FileName = "cmd.exe";
procStartInfo.RedirectStandardOutput = true;
procStartInfo.UseShellExecute = false;
procStartInfo.CreateNoWindow = true;
Process proc = new Process();
proc.StartInfo = procStartInfo;
proc.Start();
proc.WaitForExit();
// What should I check here to make sure rebase happened without conflicts
var response = await proc.StandardOutput.ReadToEndAsync();