I have a small project I was working on without any kind of version control software, and I ended up with three different versions of the same script, where each one does something slightly different from the others. I initialized a git repo with one of the versions, and I’d really like to commit each of the other two without parents. That way, I can merge the differences as though each of the three versions of the script were the tips of different branches.
I’m not even sure whether this is necessarily a sane or reasonable way to go about solving this problem… Any advice on how to do things this way, or advice on a better way to handle this situation would be much appreciated.
From my comment:
Which I think would agree with ctcherry’s answer as well.
But if you really do want to create a completely different “branch” that is unrelated to master, then you can do it with
git checkout --orphan. The manual forgit checkoutdescribes to work of the option--orphan:You might use it like this:
If your Git is older than 1.7.2 (when
git checkout --orphanwas introduced), then you can use the alternate command sequence from “Creating New Empty Branches” in the Git Community Book: