Reputation: 9620
I tried out In git, is there a simple way of introducing an unrelated branch to a repository? but could not find any correct solution.
What I exactly want is to create a new branch, say v2
. The branch v2
will have the contents of the master
branch but should be independent of the master
. Also the v2
branch should be in a separate directory.
My current local directory is :
|light-mvc
| --master // contains the master branch
| --v2 // should contain the v2 branch
and my remote repo is https://github.com/YashKumarVerma/Light-PHP-MVC (if it matters)
Upvotes: 1
Views: 156
Reputation: 3154
You can do something like this.
Assuming right now you have only master
folder inside light-mvc
and is up-to-date with your remote.
Now make a branch using git branch v2
. Then git checkout v2
and make a new directory v2
and put whatever code you want to put into it. Then push on the same branch ,i.e., v2
.
So essentially your master branch has master
folder and v2 branch has master
+ v2
folder.
I hope this solves it.
Upvotes: 2