how to create a new branch on Github?

Asked

Viewed 39,435 times

1

I wonder how to create a new branch on Github

I already have the master branch created and I didn’t see any "create branch" option, someone can help me?

3 answers

10

In addition to the Doougui option, you can use command on the terminal:

git checkout -b MinhaNovaBrach

Then, when you want to branch up, commit:

git commit -m 'Comentário do commit da minha nova branch'

Then going up in a suit:

git push --set-upstream origin MinhaNovaBrach

I recommend reading this guide: https://rogerdudler.github.io/git-guide/index.pt_BR.html

  • 11

    If you’re too lazy to type --set-upstream, the equivalent short option is -u

7


Open your repository on Github logged in to your account and click on the "branch" option as shown in the image below. After that just type the branch name in the field and it will be created automatically.

Criando branch no GitHub

  • vlw for help, it worked!

  • @Schielke since this is the answer that answers your question, then mark it as accepted by clicking on the left side

2

Also by the terminal:

To create the new branch from the branch you are on:

git branch MinhaNovaBrach

To create the new branch from a specific branch:

git branch -c branchEspecifica MinhaNovaBrach

In both cases you need to switch to the created branch, commit and trancking:

git checkout MinhaNovaBrach

git commit -m "Olha que commit lindo <3"

git push -u origin MinhaNovaBrach

Browser other questions tagged

You are not signed in. Login or sign up in order to post.