Git : Git-SVN を利用する2022/09/27 |
|
サーバー側が Subversion リポジトリを使用している場合に、クライアント側で Git-SVN
をインストールすると、Subversion リポジトリに対して Git のワーキングリポジトリを作成して利用することができます。
|
|
| [1] | クライアント側で Git-SVN をインストールしておきます。 |
|
root@node01:~# apt -y install git-svn
|
| [2] | 当例では Subversion サーバー側で [svnserve] が稼働中であることを前提に進めます。(必須ではない) また Subversion サーバー [dlp.srv.world] 上の [/var/svn/repos/project] リポジトリに対して操作します。 |
|
# [git svn ***] で SVN リポジトリからクローン jammy@node01:~/work$ git svn clone --username ubuntu svn://dlp.srv.world/repos/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/jammy/work/project/.git/
Authentication realm: <svn://dlp.srv.world:3690> 483017c4-bf3f-4328-aa78-bd26248e8cca
Password for 'ubuntu':
W: +empty_dir: trunk
r1 = 881c7904e8d28647e19f6bfd4611841a9566ae1c (refs/remotes/git-svn)
W: +empty_dir: branches
r2 = c4097cabf1bdf0e6e2075ca035cee75868fc225d (refs/remotes/git-svn)
W: +empty_dir: tags
r3 = f259f83b94b3c3acc55a8f27f206b578a751d048 (refs/remotes/git-svn)
A trunk/index.html
r4 = 9bdd1c1160be0152a2df114d85c324a1fe69541f (refs/remotes/git-svn)
M trunk/index.html
r5 = f0430c1ea8f90d4315f9574146ede2628dbc439b (refs/remotes/git-svn)
Checked out HEAD:
svn://dlp.srv.world/repos/project r5
creating empty directory: branches
creating empty directory: tags
jammy@node01:~/work$ total 12 drwxrwxr-x 3 jammy jammy 4096 Sep 27 02:04 ./ drwxr-x--- 5 jammy jammy 4096 Sep 27 02:02 ../ drwxrwxr-x 6 jammy jammy 4096 Sep 27 02:04 project/jammy@node01:~/work$ cd project/trunk jammy@node01:~/work/project/trunk$ total 12 drwxrwxr-x 2 jammy jammy 4096 Sep 27 02:07 ./ drwxrwxr-x 6 jammy jammy 4096 Sep 27 02:04 ../ -rw-rw-r-- 1 jammy jammy 22 Sep 27 02:04 index.html # 適当にファイルを更新して 更新したファイルを [commit] jammy@node01:~/work/project/trunk$ echo "test file" >> index.html jammy@node01:~/work/project/trunk$ git commit index.html -m "update" [master 447961a] update 1 file changed, 1 insertion(+) # 更新を [push] する場合は [dcommit] jammy@node01:~/work/project/trunk$ git svn dcommit
Committing to svn://dlp.srv.world/repos/project ...
Authentication realm: <svn://dlp.srv.world:3690> 483017c4-bf3f-4328-aa78-bd26248e8cca
Password for 'ubuntu':
M trunk/index.html
Committed r6
M trunk/index.html
r6 = c5b14889dd8ccab6c508c1d479e9da5e642f13f9 (refs/remotes/git-svn)
No changes between a721466bfdd0fe5afed0f021fde79528b19ae5a9 and refs/remotes/git-svn
Resetting to the latest refs/remotes/git-svn
# 他人が更新したファイルを自身のローカルディレクトリにマージする場合は [rebase] jammy@node01:~/work/project/trunk$ git svn rebase
M trunk/index.html
r7 = 5409bba49db298910223e7dcb8dafcad0932e3b6 (refs/remotes/git-svn)
Successfully rebased and updated refs/heads/master.
|
| Sponsored Link |
|
|