Skip to content

Commit f016e2a

Browse files
authored
Merge pull request #633 from mkarg/patch-5
Adapted to current git version
2 parents ff4f627 + 0bec5db commit f016e2a

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

book/09-git-and-other-scms/sections/import-svn.asc

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ This makes your `import` command look like this:
3737
[source,console]
3838
----
3939
$ git svn clone http://my-project.googlecode.com/svn/ \
40-
--authors-file=users.txt --no-metadata -s my_project
40+
--authors-file=users.txt --no-metadata --prefix "" -s my_project
4141
----
4242

4343
Now you should have a nicer Subversion import in your `my_project` directory.
@@ -76,18 +76,16 @@ To move the tags to be proper Git tags, run:
7676

7777
[source,console]
7878
----
79-
$ cp -Rf .git/refs/remotes/origin/tags/* .git/refs/tags/
80-
$ rm -Rf .git/refs/remotes/origin/tags
79+
$ for t in $(git for-each-ref --format='%(refname:short)' refs/remotes/tags); do git tag ${t/tags\//} $t && git branch -D -r $t; done
8180
----
8281

83-
This takes the references that were remote branches that started with `remotes/origin/tags/` and makes them real (lightweight) tags.
82+
This takes the references that were remote branches that started with `refs/remotes/tags/` and makes them real (lightweight) tags.
8483

8584
Next, move the rest of the references under `refs/remotes` to be local branches:
8685

8786
[source,console]
8887
----
89-
$ cp -Rf .git/refs/remotes/origin/* .git/refs/heads/
90-
$ rm -Rf .git/refs/remotes/origin
88+
$ for b in $(git for-each-ref --format='%(refname:short)' refs/remotes); do git branch $b refs/remotes/$b && git branch -D -r $b; done
9189
----
9290

9391
It may happen that you'll see some extra branches which are suffixed by `@xxx` (where xxx is a number), while in Subversion you only see one branch.

0 commit comments

Comments
 (0)