0

i copied files from old cvs repo locally. when i do

git cvsimport -C . -d path-to-cvs-folder some-module

it creates a git repo with branches so then i can push the whole repo into github:

git push --mirror git@github.com:xxx.git

but the cvsimport creates master branch and also origin branch pointing to the same commit as master. there are no remotes created: git remote -v returns nothing

the question is: what is the purpose of the origin branch? in the manual there is -r switch to let me name that branch. but what for? there is no remote repo at the of migration - just locally copied cvs files. what's the idea behind it?

piotrek
  • 13,982
  • 13
  • 79
  • 165
  • Did you check `git remote -v`? What does it say? – Lasse V. Karlsen Jun 21 '18 at 11:00
  • @LasseVågsætherKarlsen it returns nothing. i updated the question – piotrek Jun 21 '18 at 11:02
  • 1
    There is some documentation regarding those origins - https://git-scm.com/docs/git-cvsimport - see if it explains it. Note that if you don't create a remote named origin, there's nothing stopping you from creating a branch named `origin/x`, it's just a branch name like any other, it's only when you add a remote named `origin` it takes on the meaning of "the branch `x` on the remote `origin`", and this meaning is loose at best. – Lasse V. Karlsen Jun 21 '18 at 11:04

1 Answers1

0

I have never used git cvsimport but it is clear from the documentation that it can be used incrementally, i.e., you can import some CVS repository, then later import any changes since the previous import. The -r switch and the names created from it are clearly intended for cvsimport's own internal use: when you do an incremental import, cvsimport uses something(s) stored in the origin branch(es) (or whatever name you choose here) to allow it to import only new changesets deduced by cvsps.

As the documentation says:

If you are performing a one-shot import of a CVS repository consider using cvs2git or cvs-fast-export.

These do not need special branches containing whatever it is that cvsimport stores there. They won't create an origin name that kind of gets in the way when you want to create a remote named origin.

(Incidentally, Git is just fine with having both a branch named origin, and a remote named origin. Remote-tracking names live in the refs/remotes/ namespace while branch names live in the refs/heads/ namespace, so these will never collide; and the remote names themselves live only in the configuration file. It's only the shortened names, like origin/master, that Git uses for human convenience and comprehension that collide here. But this is very confusing to humans, who want to use the shortened names.)

torek
  • 448,244
  • 59
  • 642
  • 775