git c#,文件更名

        private static void pushRename()
        {
            string wkDir = @"E:\DotNet2010\单位工程\Git.Client\lib2Test\ConsoleApplication1\bin\Debug\D2Git\.git";
            using (var repo = new Repository(wkDir))
            {
                //rename one.txt two.txt
                //此处设置断点,重命名目录下的文件名 one.txt->1.txt,two.txt->2.txt
                var opts = new StatusOptions
                {
                    DetectRenamesInIndex = true,
                    DetectRenamesInWorkDir = true,
                };


                RepositoryStatus status = repo.Index.RetrieveStatus(opts);
                repo.Index.Stage("one.txt");
                repo.Index.Stage("1.txt");

                repo.Index.Stage("two.txt");
                repo.Index.Stage("2.txt");
                status = repo.Index.RetrieveStatus(opts);

                //commit...
                //push...
            }

            Console.Read();
        }

鄙视csdn的保存速度,园子速度超快!

  

posted @ 2014-06-22 18:34  javasuki  阅读(247)  评论(0编辑  收藏  举报