zoukankan      html  css  js  c++  java
  • 用控制台命令拉取git最新仓库代码

    C#利用Diagnostics  拉取最新代码  示例代码

            static void DiagnosticTest()
            {
                Process p;
                ProcessStartInfo psi;
                psi = new ProcessStartInfo("sh.exe");
                psi.Arguments += "--login -i";
    
                psi.UseShellExecute = false;
                psi.RedirectStandardOutput = true;  //允许重定向标准输出
                psi.RedirectStandardInput = true;   //接受来自调用程序的输入信息
    
                psi.RedirectStandardError = true;
                psi.WindowStyle = ProcessWindowStyle.Hidden;
    
                p = Process.Start(psi);           
                
                p.StandardInput.WriteLine("cd D://");
                p.StandardInput.WriteLine("cd D:/git/Component/");
    
                p.OutputDataReceived += new DataReceivedEventHandler(OnDataReceived);            
                p.BeginOutputReadLine();
                p.BeginErrorReadLine();
    
                //p.StandardInput.WriteLine("git fetch --all");
                //p.StandardInput.WriteLine("git reset --hard origin/master");
                p.StandardInput.WriteLine("git pull");
                p.Close();
            }
            private static void OnDataReceived(object Sender, DataReceivedEventArgs e)
            {
                if (e.Data == "Already up-to-date.")
                {
                    Console.WriteLine("已拉取最新的Component代码");
                }
            }
  • 相关阅读:
    作业20181127-1 附加作业 软件工程原则的应用实例分析
    20181120-1 每周例行报告
    20181113-2 每周例行报告
    获奖感言
    作业 20181030-4 每周例行报告
    20181023-3 每周例行报告
    Weekly 13
    Weekly 10
    Weekly 11
    weekly 8
  • 原文地址:https://www.cnblogs.com/liyunhua/p/6288725.html
Copyright © 2011-2022 走看看