-1

I`m very confuse about git basics. I have a local branch "develop" and I created a new local branch "branch_1" from "develop" using command: git checkout -b branch_1.

I need to create a remote branch "branch_1" on GitHub and connect my local branch "branch_1" to it, but I`m not sure what is the proper way to do it. Since "branch_1" is not exist yet on GitHub, how I can create it from terminal? In my previous attempt, I created a new branch using GitHub website and ended up with an orphan branch. Can anyone provide me with the next step, please?


I used git push and got: The current branch branch_1 has no upstream branch. To push the current branch and set the remote as upstream, use git push --set-upstream origin branch_1

After I executed this command, it created a new branch branch_1 on the Git Hub.

2
  • 1
    You just need to do git push on your local branch , enter your credentials and voilà, the local branch is in github. Commented Jan 14, 2022 at 21:15
  • I`m not sure if I do git push, to with branch on GitHub it will go. Commented Jan 14, 2022 at 21:16

1 Answer 1

1

Without needing to create any new branches directly on GitHub, you should be able to run

git push -u origin branch_1

(or whatever your remote name is instead of origin). This will automatically create the new remote branch branch_1and set up your local branch_1 to track it.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.