0

I see a relevant answer for creating an empty remote branch from master on this: Is it possible in git to create a new, empty remote branch without pushing?, using the following command:

git push origin origin:refs/heads/new_feature_name

But I need to create this new remote branch from a specific branch, other than master, without pushing code from local branch. How do I achieve that?

manadu
  • 11
  • 2
  • There's no such thing as an *empty* branch, in Git. That's not particularly important to your problem but if you think of this as "create an empty branch" you'll eventually get stuck because there isn't any such thing. – torek Jan 08 '21 at 21:55

1 Answers1

0

First commit your local changes. Suppose if you want to create a branch from branch A which is not a master branch. Then go to that branch by using below command

git checkout A

Then execute below commands.

  1. git checkout -b branch_name
  2. git push origin branch_name

The above commands create local and remote branches.

netajik
  • 196
  • 1
  • 4
  • 15