gitInfo.Arguments = "-c \"" + "git diff-tree -r 61140bb40f879dd21e8624fe8e2125df846572e8" + "\"";
ProcessStartInfo gitInfo = new ProcessStartInfo(); gitInfo.CreateNoWindow = false; gitInfo.UseShellExecute = false; gitInfo.RedirectStandardError = true; gitInfo.RedirectStandardOutput = true; gitInfo.FileName = @"C:\Program Files\Git\git-bash.exe"; Process gitProcess = new Process(); gitInfo.WorkingDirectory = @"D:\CodeBranch"; gitInfo.Arguments = "-c \"" + "git diff-tree -r 61140bb40f879dd21e8624fe8e2125df846572e8" + "\""; gitProcess.StartInfo = gitInfo; gitProcess.Start(); string stderr_str = gitProcess.StandardError.ReadToEnd(); // pick up STDERR string stdout_str = gitProcess.StandardOutput.ReadToEnd(); // pick up STDOUT gitProcess.WaitForExit(); gitProcess.Close();
I could able to solve this issue in different way. Since i am not aware of how to give this command line argument in c# Process, i written a batch file with all those GIT commands and called that batch file from c# code and it worked like a charm..
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)