-2

We have a requirement, where we have to create a feature branch in Github repository. But the problem is whenever I am creating the feature branch, the contents of master is getting replicated in the feature branch.

Is there any way that the contents of master does not get replicated in the feature branch, when it is created?

eddyP23
  • 6,420
  • 7
  • 49
  • 87
  • 1
    Hm... What do you want to see in the feature branch? – eddyP23 Sep 25 '18 at 06:08
  • 1
    And it is not github issue. Git is the tool that creates another branch – eddyP23 Sep 25 '18 at 06:09
  • In git you typically _branch_ away from a certain branch (often called the "parent"). In the github UI you'd first switch to the desired parent branch (which is not master in your case) and then branch away from there. Does this help? – reto Sep 25 '18 at 07:31

2 Answers2

0

Are you sure you want a "feature" branch, and not just an empty one?

A "feature" branch adds some functionality to an existing branch, like the master branch.

If you just want an empty one, you may do it the following way:

How to create a new empty branch for a new project

YesThatIsMyName
  • 1,585
  • 3
  • 23
  • 30
0

Thats how git works. Maybe you are in need of a new and empty repo. When you create a feature branch, it is a copy of master by default. After your changes are complete you have to raise a pull request to merge feature branch to master branch. Please refer this link for more information https://nvie.com/posts/a-successful-git-branching-model/. You are in need of a new repo I suppose. Creating an empty branch during development is a bad idea.

staticvoidmain
  • 793
  • 6
  • 14