FreeBSD 14
Sponsored Link

Git : Use Git-SVN2024/09/13

 

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:~ #
pkg install -y git-svn
[2] On this example, it is based on that [svnserve] is running on Subversion Server Host. (not mandatory requirements)
Also Access to [/home/svn/repos/project] repository on Subversion Server [dlp.srv.world].
freebsd@node01:~ $
mkdir work

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

freebsd@node01:~/work $
git svn clone --username freebsd svn://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/freebsd/work/project/.git/
Authentication realm: <svn://dlp.srv.world:3690> 3247b0a6-6571-ef11-b1e8-df8f47688296
Password for 'freebsd':
W: +empty_dir: trunk
r1 = f16cef4725ec1d18769b2dd5af3948daa17306a1 (refs/remotes/git-svn)
W: +empty_dir: branches
r2 = 139938b2716a37e235cf4051cf71c785e5a6cb17 (refs/remotes/git-svn)
W: +empty_dir: tags
r3 = 366b3257bf6d703663f721ee8b348595942d5fe3 (refs/remotes/git-svn)
        A       trunk/index.html
r4 = f35a31d6883633156245110576d52e0da2e9742c (refs/remotes/git-svn)
        M       trunk/index.html
r5 = 785be2c7bccfd7f7502c757c9a6cc730cf98b2f0 (refs/remotes/git-svn)
        M       trunk/index.html
r6 = cd6a56080dcb0859fe8ee0feccf8c8852dcc5771 (refs/remotes/git-svn)
Checked out HEAD:
  svn://dlp.srv.world/project r6
creating empty directory: branches
creating empty directory: tags

freebsd@node01:~/work $
ls -l

total 1
drwxr-xr-x  6 freebsd freebsd 6 Sep 13 15:38 project

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

freebsd@node01:~/work/project/trunk $
ls -l

total 1
-rw-r--r--  1 freebsd freebsd 33 Sep 13 15:38 index.html

# [commit] updated file

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

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

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

# to [push], specify [dcommit]

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

Committing to svn://dlp.srv.world/project ...
Authentication realm: <svn://dlp.srv.world:3690> 3247b0a6-6571-ef11-b1e8-df8f47688296
Password for 'freebsd':
        M       trunk/index.html
Committed r7
        M       trunk/index.html
r7 = 06e7d0ff857d9e9d6bb5dba91d23632f5a91d787 (refs/remotes/git-svn)
No changes between 856d56962e0c51beabc2ecd88a08232de322d0f4 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]

freebsd@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