Post

git-svn From GitHub To Svn

git-svn From GitHub To Svn

1. Clone from svn

1
git svn init https://140.122.66.77/svn/personnel_matters --trunk=PrivLib --branches=MavenizeProjects/{PrivLib} PrivLib

2. Setting the authorsfile

1
git config svn.authorsfile ~/authors.txt
  1. Edit content of .git/config:
1
2
3
4
5
6
7
8
9
10
11
12
13
[core]
        repositoryformatversion = 0
        filemode = true
        bare = false  
        logallrefupdates = true
        ignorecase = true
        precomposeunicode = true
[svn-remote "svn"]
        url = https://140.122.66.77/svn/personnel_matters
        fetch = PrivLib:refs/remotes/origin/trunk
        branches = MavenizeProjects/{PrivLib}/*:refs/remotes/origin/*
[svn]
        authorsfile = ~/authors_PmbMgr.txt

Modify these line:

1
2
fetch = PrivLib:refs/remotes/origin/trunk
branches = MavenizeProjects/{PrivLib}/*:refs/remotes/origin/*

to

1
2
fetch = PrivLib:refs/remotes/git-svn/trunk
branches = MavenizeProjects/{PrivLib}:refs/remotes/feature-jdk17/*
  1. fetch
1
git svn fetch
  1. checkout feature-jdk17/PrivLib
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Note: switching to 'feature-jdk17/PrivLib'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at 08b92ec jdk17版: 已同步原 jdk6 的 r5161
➜  ~/Downloads/PrivLib git:(08b92ec) git branch
➜  ~/Downloads/PrivLib git:(08b92ec) 
  1. switch -c
1
git switch -c feature-jdk17
This post is licensed under CC BY 4.0 by the author.