How to Create Development Branch from Master on Github

I created a repo on GitHub and only have a master branch so far. My local working copy is completely up to date with the remote/origin master on GitHub.

I now want to create a development branch on GitHub so that other people on my team can start pushing changes to development (instead of directly to master) and submit PRs, request code reviews, etc.

So I tried creating a new development branch locally and pushing it:

git checkout -b development
git push origin development:master

But git just says Everything up-to-date. So I ask:

If I'm current with master, how do I just create a remote development branch that contains an exact copy of master?

1

4 Answers

When you do

$ git push origin development:master

What's actually happening is git is taking <local>:<remote> and updating <remote> to whatever the <local> branch is.

Since you executed git checkout -b development from master, your local development has all the commits master does; hence it shows as everything is up to date.

You can just do

$ git checkout -b development
$ git push origin development

to push the new branch

2

Creating a git develop branch

You can list all of your current branches like this:

git branch -a

This shows all of the local and remote branches. Assuming you only have a single master branch, you'd see the following:

* master
  remotes/origin/master

The * means the current branch.

To create a new branch named develop, use the following command:

git checkout -b develop

The -b flag creates the branch. Listing the branches now should show:

* develop
  master
  remotes/origin/master
Sophia Al-Mansoor

Sophia Al-Mansoor

Global Business & E-Commerce Reporter

Sophia analyzes international trade, startup ecosystems, retail transformation, and supply chain logistics for modern digital publications.