threads / discuss / 27729

importing history

Subject: importing history

## tl;dr

6 messages between Jun 29, 2011 and Jun 30, 2011.

replies: 5people: 3as markdown or json

Mihamina Rakotomandimby· Jun 29, 2011, 13:45 UTC · lore
Hi,
Still newcomer in GIT ;-)

Let the nurpawiki SVN repo here: http://code.google.com/p/nurpawiki/source/checkout

I know how to clone it using "git svn clone ..." "git log" shows the whole history: fine!

Then I created an account in a forge (like github or so...), where I had to clone an empty GIT repository in order to begin to work. I dont have admin access to the forge, so no "scp" to the repo hosting possible.

Now, I have 2 "local" repos:
- the one from the SVN
- the empty one from the forge

I am looking for a document that would teach me how to "import" the "from-svn" into the empty one. What are the keywords for that action (to help me searching)?

After I do that, I will just have to push to the previously empty origin and I'm done.

Thanks for your help.
-- 
RMA.
Christof Krüger· Jun 29, 2011, 14:25 UTC · re: Mihamina Rakotomandimby · lore

Re: importing history

Hi,
> Then I created an account in a forge (like github or so...), where I
> had to clone an empty GIT repository in order to begin to work.
> I dont have admin access to the forge, so no "scp" to the repo
> hosting possible.

Why did you have to clone an empty repository? It should be enough to add the correct remote config directly in your "from-svn" repository and just push it.

> Now, I have 2 "local" repos:
> - the one from the SVN
> - the empty one from the forge

Now that you already have cloned the empty repository you can just look at the remote configuration in it:

 git config --list|grep remote
You should see something like the following:

remote.origin.url=user@example.com/path/to/repository.git remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*

Go to your from-svn repository and add the above configuration, then "git push origin master".

Good luck!
Regards,
  Chris
Andreas Schwab· Jun 29, 2011, 16:56 UTC · re: Christof Krüger · lore

Re: importing history

Christof Krüger <git@christof-krueger.de> writes:
Show 12 quoted lines
> Now that you already have cloned the empty repository you can just look at
> the remote configuration in it:
>
>  git config --list|grep remote
>
> You should see something like the following:
>
> remote.origin.url=user@example.com/path/to/repository.git
> remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
>
> Go to your from-svn repository and add the above configuration, then "git
> push origin master".

Careful. git svn uses the remotes namespace in a non-std way. Better to locally clone the from-svn repository into a new one, then use "git remote add origin user@example.com/path/to/repository.git" to add the remote repository. Then you can safely push the master branch.

Andreas.
-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
Christof Krüger· Jun 29, 2011, 17:02 UTC · re: Andreas Schwab · lore

Re: importing history

On Mi, 2011-06-29 at 18:56 +0200, Andreas Schwab wrote:
> Careful.  git svn uses the remotes namespace in a non-std way.  Better
> to locally clone the from-svn repository into a new one, then use "git
> remote add origin user@example.com/path/to/repository.git" to add the
> remote repository.  Then you can safely push the master branch.

Doesn't git svn use svn-remove.svn.* and not remote.*? I've been doing that before and it worked for me.

"git svn dcommit" and "git push" are orthogonal to my understanding. If you have an example, where git svn doesn't play well with "usual" git remotes, I'd be happy to see them.

Regards,
  Chris 
Andreas Schwab· Jun 29, 2011, 21:35 UTC · re: Christof Krüger · lore

Re: importing history

Christof Krüger <git@christof-krueger.de> writes:
Show 6 quoted lines
> On Mi, 2011-06-29 at 18:56 +0200, Andreas Schwab wrote:
>> Careful.  git svn uses the remotes namespace in a non-std way.  Better
>> to locally clone the from-svn repository into a new one, then use "git
>> remote add origin user@example.com/path/to/repository.git" to add the
>> remote repository.  Then you can safely push the master branch.
> Doesn't git svn use svn-remove.svn.* and not remote.*?

I'm not talking about the config options, but of the ref namespace. If your svn repository would have a branch named origin it would be stored as refs/remotes/origin by git svn, which would conflict with "git remote add origin ..."

Andreas.
-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
Christof Krüger· Jun 30, 2011, 05:00 UTC · re: Andreas Schwab · lore

Re: importing history

On Mi, 2011-06-29 at 23:35 +0200, Andreas Schwab wrote:
> I'm not talking about the config options, but of the ref namespace.  If
> your svn repository would have a branch named origin it would be stored
> as refs/remotes/origin by git svn, which would conflict with "git remote
> add origin ..."

Ah, thanks for explaining. As of now, I only had to do with rather "dump" SVN repositories with only a trunk (or only non-stdlayout branches I didn't care about anyways).

But do you think things could be seriously screwed up because of this? Or would just one of the commands gracefully fail, leaving the unexperienced user with an error message he doesn't understand?

Chris.

← back to recent threads