-2

In my repository, I have a master branch which has all of the latest code.

I need to have a development branch which is cut from the master branch, so that developers can further cut feature/bugfix branches from the development branch and merge code back to the development branch.

How can I create a development branch from the master branch such that work can be done on both in parallel?

Dykotomee
  • 728
  • 6
  • 20
jap
  • 37
  • 1
  • 1
  • 3
  • 1
    Possible duplicate of [Create a branch in Git from another branch](https://stackoverflow.com/questions/4470523/create-a-branch-in-git-from-another-branch) – phd Jan 11 '19 at 18:15
  • https://stackoverflow.com/search?q=%5Bgit-branch%5D+how+to+create+branch – phd Jan 11 '19 at 18:15

1 Answers1

6

First, checkout your master branch:

git checkout master

Then cut a branch called develop:

git checkout -b develop

When you need to make further changes to develop, cut new branches in a similar fashion while develop is checked out:

git checkout -b feature

To merge a feature back into your develop branch, checkout develop and execute a merge:

git checkout develop
git merge --no-ff feature

(While --no-ff is not necessary, I prefer using this to ensure an explicit merge commit is shown in history.)

I would highly recommend investigating a Git workflow. A very common one is Gitflow, but there are others.

Dykotomee
  • 728
  • 6
  • 20