equityanna.blogg.se

Git reset branch to origin
Git reset branch to origin






git reset branch to origin

  • The origin in origin/master is used to denote the remote name and the master is used to denote the remote branch that it is tracking.
  • Origin/master is just a remote-tracking branch present in our local repository that tracks the changes made to the master branch in the remote repository.
  • We just learned that origin and master are two different things but sometimes we may get confused when we see the word origin/master.
  • We can rename this branch by using the -m flag with the Git Branch command. Now, we can run the Git Branch command and see that we only have a single branch in our repository which is called the master. We will create an empty commit because a branch is just a pointer to a commit, and we will need one to view the master branch(the branch name is also visible in blue color next to the path of our directory). This name is just used to denote that it is the main branch of our repository.Ĭonsider the following example where we initialize a new Git repository.
  • Again, there is nothing exceptional about this name, and we can rename our master branch to something else.
  • All other branches will be created based on some commit of this branch and will eventually merge into the master branch.

    git reset branch to origin

    This branch will have the final, up-to-date, production-ready code.When a new Git repository is initialized using the Git Init command, it will only have a single branch and that branch, by default, is called the master.Master is the default name that Git gives to a branch when we create a new repository.We can also change this default name with the help of the Git Remote Rename command. We can see in the image below that we have a remote called origin. Next, we are going to check the remotes present by using the Git Remote command. First, we will run the Git Clone command, and pass the URL for the remote repository. There is nothing extraordinary about this word and we can use any other name that we like.Ĭonsider the example below where we try to clone a remote repository to our local system. It is a standard default name given to the repository from where our local repository originated.This name will be used in the future when we have to push or pull changes from the remote repository. In Git terminology, the origin is the name given to the remote repository from where we clone our local repository. This same definition can be applied to the word origin which is used in Git.

    git reset branch to origin

    Origin, in simple terms, is described as the place from where something begins or is derived.Let's learn more about origin and master, and see how they are used. Origin is the default name given to a remote repository, and master is simply a branch name. Origin and master are two terms frequently used when working on a project managed using Git.








    Git reset branch to origin