There is an option called orphan
for the git checkout
command to do what I think you need that in itself is:
Create a branch without files from an existing repository
Your description in English
Create a new orphan branch, named <new_branch>
, started from
<start_point>
and switch to it. The first commit made on this new
branch will have no parents and it will be the root of a new history
totally disconnected from all the other branches and commits.
Translation (personal (if you have a better feel free to edit my answer))
Create an orphan branch, called <nueva_rama>
, started from
<punto_de_inicio>
and change it to this. The first commit
done in
this new branch will not have parents and will be the root of a new story
totally disconnected from all other branches and commits
For which in conclusion you could do the following:
// Aquí creamos nuestra rama sin padre, independiente y sin historia
// pero con los archivos 'track' y 'untrack' que tengamos
// actualmente en nuestro directorio
git checkout --orphan nueva_rama_independiente_de_todas_las_otras
(The above is thanks to the user's clarification sstan )
// Como los archivos seguirán presentes después de crear la rama
// procedemos a eliminar todos los archivos que han sido y/o estado
// 'track' y 'untrack'
git rm --cached -rf .
(The above is thanks to the user's advice (very useful and true by the way) Jhd )
Note that it is not necessary to use the -b
option since when using --orphan
it will go from the current branch to the one created as it can be read in the description of this option.