2

git checkout -b newBranch baseBranch

I don't wanna git push origin newBranch

How can I push the newBranch as a childBranch of baseBranch

After that can I merge the newBranch directly to master?

Liuuil
  • 1,441
  • 3
  • 16
  • 22

1 Answers1

4

There is no notion of "child branch": a branch is simply a sequence of commits: Your newBranch simply starts from the current HEAD of baseBranch, but it is actually composed of all baseBranch commits, and of the new commits you are about to create.
See more at "Find the parent branch of a Git branch".

You can push newBranch to GitHub without worrying about baseBranch.

git push -u origin newBranch

And you can merge that branch to any other branch you want.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250