Ubuntu 24.04
Sponsored Link

Git : Use Git-SVN2024/07/24

 

For the case Subversion repositories are used on Server Side, it's possible to use them from Git working repositories with Git-SVN.

[1] Install Git-SVN on Client Side.
root@node01:~#
apt -y install git-svn
[2] On this example, it is based on that [svnserve] is running on Subversion Server Host. (not mandatory requirements)
Also Access to [/var/svn/repos/project] repository on Subversion Server [dlp.srv.world].
noble@node01:~$
mkdir work

noble@node01:~$
cd work
# clone with [git svn ***] from SVN repository

noble@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/noble/work/project/.git/
Authentication realm: <svn://dlp.srv.world:3690> 84792bc8-15d0-4409-8573-be73eacd8478
Password for 'ubuntu':
W: +empty_dir: trunk
r1 = d8797dc84cafb54d37e6d80ceffb2916d0e19291 (refs/remotes/git-svn)
W: +empty_dir: branches
r2 = c44caa26838323b5d3e8a271a1661bfdc8ed8d35 (refs/remotes/git-svn)
W: +empty_dir: tags
r3 = 9b7f6c15993a17b19782fcc331f7e134e192bd6a (refs/remotes/git-svn)
        A       trunk/index.html
r4 = e6afeff3c0f0d20140a234fe6794aeb47a70a36a (refs/remotes/git-svn)
        M       trunk/index.html
r5 = 39d1b89614de6265dbe6321adbfcf52e01d136f3 (refs/remotes/git-svn)
        M       trunk/index.html
r6 = 3145148cd539f4138d04dbce7095079dbc163334 (refs/remotes/git-svn)
Checked out HEAD:
  svn://dlp.srv.world/repos/project r6
creating empty directory: branches
creating empty directory: tags

noble@node01:~/work$
total 12
drwxrwxr-x 3 noble noble 4096 Jul 24 04:28 ./
drwxr-x--- 5 noble noble 4096 Jul 24 04:00 ../
drwxrwxr-x 6 noble noble 4096 Jul 24 04:28 project/

noble@node01:~/work$
cd project/trunk

noble@node01:~/work/project/trunk$
total 12
drwxrwxr-x 2 noble noble 4096 Jul 24 04:28 ./
drwxrwxr-x 6 noble noble 4096 Jul 24 04:28 ../
-rw-rw-r-- 1 noble noble   37 Jul 24 04:28 index.html

# [commit] updated file

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

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

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

# to [push], specify [dcommit]

noble@node01:~/work/project/trunk$
git svn dcommit

Committing to svn://dlp.srv.world/repos/project ...
Authentication realm: <svn://dlp.srv.world:3690> 84792bc8-15d0-4409-8573-be73eacd8478
Password for 'ubuntu':
        M       trunk/index.html
Committed r7
        M       trunk/index.html
r7 = 1e18f82772e3540c0828c24f933765dbdc15ab56 (refs/remotes/git-svn)
No changes between 1a482e305e2f1d99d555ec351cd3b1a8295841cd and refs/remotes/git-svn
Resetting to the latest refs/remotes/git-svn

# to merge the latest updates by others to your local working repository, specify [rebase]

noble@node01:~/work/project/trunk$
git svn rebase

Authentication realm: <svn://dlp.srv.world:3690> 84792bc8-15d0-4409-8573-be73eacd8478
Password for 'ubuntu':
        M       trunk/index.html
r8 = a6a06c30b42bc3b3543cc0206196297644fcf2b0 (refs/remotes/git-svn)
Successfully rebased and updated refs/heads/master.
Matched Content