Debian 13 trixie

Git : Git-SVN を利用する2025/10/10

 

サーバー側が Subversion リポジトリを使用している場合に、クライアント側で Git-SVN をインストールすると、Subversion リポジトリに対して Git のワーキングリポジトリを作成して利用することができます。

[1] クライアント側で Git-SVN をインストールしておきます。
root@node01:~#
apt -y install git-svn
[2] 当例では Subversion サーバーへ HTTP アクセス可能であることを前提に進めます。(必須ではない)
また Subversion サーバー [dlp.srv.world] 上の [/var/svn/repos/project] リポジトリに対して操作します。
trixie@node01:~$
mkdir work3

trixie@node01:~$
cd work3
# [git svn ***] で SVN リポジトリからクローン

trixie@node01:~/work3$
git svn clone --username debian https://dlp.srv.world/project

hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint:
hint:   git config --global init.defaultBranch <name>
hint:
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint:
hint:   git branch -m <name>
Initialized empty Git repository in /home/trixie/work3/project/.git/
Authentication realm: <https://dlp.srv.world:443> DAV SVN
Password for 'debian':
W: +empty_dir: trunk
r1 = da0c12640406f7e8de4bdc8f82c51a4c1b14dbdb (refs/remotes/git-svn)
W: +empty_dir: branches
r2 = 840be1a66ba0c6d2816e6502260cc3574eba78f0 (refs/remotes/git-svn)
W: +empty_dir: tags
r3 = 21ce4180d0ab60d1647cc6d44795637dcecaf7e3 (refs/remotes/git-svn)
        A       trunk/index.html
r4 = 6ddb858c6a52317f241878d1c48c549dba7a3141 (refs/remotes/git-svn)
        A       trunk/testfile.txt
r5 = fdc29f34dd98eeb2ceaa9b3281e842541af6b805 (refs/remotes/git-svn)
Checked out HEAD:
  https://dlp.srv.world/project r5
creating empty directory: branches
creating empty directory: tags

trixie@node01:~/work3$
total 4
drwxrwxr-x 6 trixie trixie 4096 Oct 10 10:06 project

trixie@node01:~/work3$
cd project/trunk

trixie@node01:~/work3/project/trunk$
total 8
-rw-rw-r-- 1 trixie trixie 22 Oct 10 10:06 index.html
-rw-rw-r-- 1 trixie trixie  9 Oct 10 10:06 testfile.txt

# 適当にファイルを更新して 更新したファイルを [commit]

trixie@node01:~/work3/project/trunk$
echo "test file" >> index.html

trixie@node01:~/work3/project/trunk$
git commit index.html -m "update"

[master 5cd6e3a] update
 1 file changed, 1 insertion(+)

# 更新を [push] する場合は [dcommit]

trixie@node01:~/work3/project/trunk$
git svn dcommit

Duplicate specification "id|i=s" for option "i"
Committing to https://dlp.srv.world/project ...
Authentication realm: <https://dlp.srv.world:443> DAV SVN
Password for 'debian':
        M       trunk/index.html
Committed r6
        M       trunk/index.html
r6 = b29205a4e3c39c37dc9d7fb64d7387ddf51ec562 (refs/remotes/git-svn)
No changes between 5cd6e3a021e34a3d4548d726eff550071c33e7d7 and refs/remotes/git-svn
Resetting to the latest refs/remotes/git-svn

# 他人が更新したファイルを自身のローカルディレクトリにマージする場合は [rebase]

trixie@node01:~/work3/project/trunk$
git svn rebase

Authentication realm: <https://dlp.srv.world:443> DAV SVN
Password for 'debian':
        M       trunk/index.html
r8 = a6a06c30b42bc3b3543cc0206196297644fcf2b0 (refs/remotes/git-svn)
Successfully rebased and updated refs/heads/master.
関連コンテンツ