CentOS Stream 9
Sponsored Link

Git : Use Git-SVN2022/07/21

 
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 ~]#
dnf -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].
[redhat@node01 ~]$
mkdir work

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

[redhat@node01 work]$
git svn clone --username cent 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/redhat/work/project/.git/
Authentication realm: <svn://dlp.srv.world:3690> 96feb78d-5d30-4dfb-b880-d0c1c719d5e2
Password for 'cent':
W: +empty_dir: trunk
r1 = 9052d23b695fc0646c9345b8b4069e1284b795e6 (refs/remotes/git-svn)
W: +empty_dir: branches
r2 = 0a30039aa7f45879018abb9811d051bd5c0304bc (refs/remotes/git-svn)
W: +empty_dir: tags
r3 = 7ab101e77b94963b5910671b37f74726e7be4b06 (refs/remotes/git-svn)
Checked out HEAD:
  svn://dlp.srv.world/repos/project r3
creating empty directory: branches
creating empty directory: tags
creating empty directory: trunk

[redhat@node01 work]$
total 0
drwxr-xr-x. 6 redhat redhat 59 Jul 21 15:04 project

[redhat@node01 work]$
cd project/trunk

[redhat@node01 trunk]$
total 12
-rw-r--r--. 1 redhat redhat 11 Jul 21 15:12 index.html
-rw-r--r--. 1 redhat redhat 11 Jul 21 15:12 testfile.txt
-rw-r--r--. 1 redhat redhat 11 Jul 21 15:12 test.txt

# [commit] updated file

[redhat@node01 trunk]$
echo "test file" >> testfile.txt

[redhat@node01 trunk]$
git commit testfile.txt -m "update"

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

# to [push], specify [dcommit]

[redhat@node01 trunk]$
git svn dcommit

Committing to svn://dlp.srv.world/repos/project ...
        M       trunk/testfile.txt
Committed r6
        M       trunk/testfile.txt
r6 = ec90e44238a2e36c1199c8dc40d10ef966ddd452 (refs/remotes/git-svn)
No changes between efe7dab8400a5322c21c3551dc41772bb41707bd 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]

[redhat@node01 trunk]$
git svn rebase

        M       trunk/index.html
r7 = 5409bba49db298910223e7dcb8dafcad0932e3b6 (refs/remotes/git-svn)
Successfully rebased and updated refs/heads/master.
Matched Content