I am running git commands using Process
from cmd.exe
, everything works fine, now I am trying to rebase a branch and want to know if rebase got successful then want to run the git push
command as next step.
Is there any way to know if git rebase got successful without conflict from the response message of Process
?
Because when it got successful it gives this response Successfully rebased and updated refs/heads/qa.
I checked this question Is there some kind of 'git rebase --dry-run', which would notify me of conflicts in advance?
The answer says if it is a non-zero response that means it is not successful but rebase does not give response in that 0/1 format, it returns text.
My code is this
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();