Reset() 공개 메소드

public Reset ( ) : void
리턴 void
예제 #1
0
        public void Branch()
        {
            //Get the current branch
            var branch = repo.CurrentBranch;

            Console.WriteLine("Current branch is " + branch.Name);

            //Another way to get the current branch
            Branch head = repo.Head;

            // check if head == master
            Debug.Assert(head.Name == "master");

            //Get master branch
            var master = new Branch(repo, "master");

            Debug.Assert(master == repo.Get <Branch>("master"));

            //Get the abbreviated hash of the last commit on master
            Console.WriteLine(master.CurrentCommit.ShortHash);

            //Create a new branch
            var b = GitSharp.Branch.Create(repo, "foo");

            // Switching to our new branch
            b.Checkout();

            //Check if foo is current branch
            Debug.Assert(b.IsCurrent);

            //Reset the branch to a previous commit (hard or soft or mixed)
            master.Reset("HEAD^", ResetBehavior.Hard);
            master.Reset("49322bb17d3acc9146f98c97d078513228bbf3c0", ResetBehavior.Soft);
            master.Reset("master", ResetBehavior.Mixed);
        }
예제 #2
0
파일: Branch.cs 프로젝트: kkl713/GitSharp
        /// <summary>
        /// Switch to the given branch
        /// </summary>
        /// <param name="branch"></param>
        public static void SwitchTo(Branch branch)
        {
            var db = branch._repo._internal_repo;

            db.WriteSymref(GitSharp.Core.Constants.HEAD, branch.Name);
            branch.Reset(ResetBehavior.Hard);
        }
예제 #3
0
파일: Examples.cs 프로젝트: dev218/GitSharp
        public void Branch()
        {
            //Get the current branch
            var branch = repo.CurrentBranch;
            Console.WriteLine("Current branch is " + branch.Name);

            //Another way to get the current branch
            Branch head = repo.Head;

            // check if head == master
            Debug.Assert(head.Name == "master");

            //Get master branch
            var master = new Branch(repo, "master");
            Debug.Assert(master == repo.Get<Branch>("master"));

            //Get the abbreviated hash of the last commit on master
            Console.WriteLine(master.CurrentCommit.ShortHash);

            //Create a new branch
            var b = GitSharp.Branch.Create(repo, "foo");

            // Switching to our new branch
            b.Checkout();

            //Check if foo is current branch
            Debug.Assert(b.IsCurrent);

            //Reset the branch to a previous commit (hard or soft or mixed)
            master.Reset("HEAD^", ResetBehavior.Hard);
            master.Reset("49322bb17d3acc9146f98c97d078513228bbf3c0", ResetBehavior.Soft);
            master.Reset("master", ResetBehavior.Mixed);
        }
예제 #4
0
파일: Branch.cs 프로젝트: stschake/GitSharp
 /// <summary>
 /// Switch to the given branch
 /// </summary>
 /// <param name="branch"></param>
 public static void SwitchTo(Branch branch)
 {
     var db = branch._repo._internal_repo;
     db.WriteSymref(GitSharp.Core.Constants.HEAD, branch.Name);
     branch.Reset(ResetBehavior.Hard);
 }