I want to create a fileless branch for an existing repository .
What I have done is this:
- make a new branch
- delete everything (except
.git
and.gitignore
, that is, the files of my project, not the control files or those generated by the editors) - do
git add .
- and then do
commit
But it looks like a brute force solution to me.
Ask
How do I create a fileless branch of an existing project?
Bonus: My repository is on github , is there a specific way to achieve this for this specific platform? If there is, what is it?
There is an option called
orphan
for the commandgit checkout
to do what I think you need which is:Your description in English
Translation (staff (if you have a better one feel free to edit my answer) )
For which in conclusion you could do the following:
(The above is thanks to the clarification of user sstan )
(The above is thanks to the advice (very useful and true by the way) of the user Jhd )
Note that it is not necessary to use the option
-b
since using--orphan
it will move from the current branch to the created one, as can be read in the description of this option.just make another branch apart from the master and develop with nothing so that what you have in production and development does not affect you. and from that same branch that you make you delete everything and commit
so you barely leave the important branches intact