gitgithub

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?


Solution

  • 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