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?
The git branch command can be used to create a new branch. When you want to start a new feature, you create a new branch off main using git branch new_branch . Once created you can then use git checkout new_branch to switch to that branch.
master — this branch contains production code. All development code is merged into master in sometime. develop — this branch contains pre-production code. When the features are finished then they are merged into develop.
Create a new branch with the branch, switch or checkout commands. Perform a git push with the –set-upstream option to set the remote repo for the new branch. Continue to perform Git commits locally on the new branch. Simply use a git push origin command on subsequent pushes of the new branch to the remote repo.
A develop branch is created from main. A release branch is created from develop. Feature branches are created from develop. When a feature is complete it is merged into the develop branch. When the release branch is done it is merged into develop and main.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With