Every thing you need to know to master git, Part 7, git branch

It quite often happens that a software product is on a git server and developers add new features to the product. To make the job easier, developers usually create branches beside the master branch (which is the default branch) and work on their branch and once the changes are confirmed and tested, they will be merged to the master branch. So let's get started:

ok now let's create two branches, one for developer1 and one for developer2,

let's make some work on the first branches:

and some changes in the second branch:

now you should see this in git gui or if you type:

Now in the git gui, go to merge>local merge and choose b1, you will get the following error because of the merge conflict:

so call the following to solve the conflict:

choose C and save and then:


Working with branches in nutshell:

Creating a branch:

Track a Remote Branch:
If you have already created a local branch and you want to track it with remote branch:

Push a branch and automatically set tracking.  you can use the -u flag (upstream) when you make your first push:


To view the branches in a Git repository:

To delete a branch:


Ref [1]

0 0 vote
Article Rating
Notify of

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Inline Feedbacks
View all comments