How To Use Git Branches with Git Merge

Branching with git is a great feature, this is a simple workflow for how to branch and merge different branches.

Many times you want to create a new branch for a feature.

This is usually the case if you want to merge your current branch with the master branch. The workflow is like this:

This is how you do it in bash / git bash.

# create branch and switch to it
> git checkout -b branch_name

# commit changes
> ...

# change back to master/dev
> git branch master

# pull latest changes
> git pull

# merge with branch
> git merge branch_name