How To Use Git Branches with Git Merge
2 min read

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:

  • Create new branch
  • Commit changes
  • Pull latest master
  • Merge

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 checkout master

# pull latest changes
> git pull

# merge with branch
> git merge branch_name