

Notice the " *" in front of the " dev" branch. Note: The creation of our branch in the local working directory is now complete. Now check the branches on the local system by typing the git branch command again: We will see an alternate way later in this tutorial. It is the initial and simpler way to create a branch in Git. Type the following command to create a new branch named " prod" ( short for production). Let's create a new branch now in our local working repository. The local branches are the same as shown in the previous section, i.e., " master". Open Git Bash and navigate to the local working repository. Type the following command to view all of your branches. But, before starting, ensure you have a clean working directory ( nothing to commit) by running the git status command.
#Git create branch conflicts how to
How to Create a Local Branch in Git?Ĭreating branches in Git is a simple step-by-step process. We will keep checking from time to time to show the user all the available branches. As we create more branches in the next section, we will reflect them here. In the highlighted red color, one more branch can be seen, which is the " dev" branch. Since we have the master branch, only the master branch displays in the output. To check all the branches ( including remote branches), type the following commands:Įxecuting the command lists all the branches, as shown below: How To View Remote Branches In Git?Įxecuting the git branch without any flag shows only those branches that are available locally.

Once you clone the repository to your local machine, all the branches will be visible through this command. We can view all the local branches by a simple command: Viewing the branches helps us keep a check on the synchronization between the remote and the local repositories.

Although in the real-world scenarios, creating branches directly through GitHub is not the primary choice for creating the branches. Branches can create through remote GitHub repository directly or through Git on our local system. It gave us a general overview of the concepts of branches. In the last tutorial, we discussed what are branches in Git.
