mobile wallpaper 1mobile wallpaper 2mobile wallpaper 3mobile wallpaper 4
104 words
1 minute
Using SVN
2024-11-04

What is SVN#

SVN is a version control system similar to Git. However, unlike Git, SVN is not distributed; instead, it uses a central server to manage the code repository. At the same time, SVN provides finer-grained file security management than Git, allowing you to checkout not only an entire repository but also a specific folder or file within the repository.

SVN Repositories#

Before using SVN, you need to have a repository.

  • Self-hosted repositories
  • Free online repositories

SVN Client#

SVN tends to favor graphical clients, such as TortoiseSVN.

SVN Command-Line Usage#

checkout#

svn checkout svn://url
svn checkout svn://url save-dir
svn checkout svn://url --username xxx --password xxx

commit#

# 描述是必须的,但是可以填写空字符串,不指定
svn commit -m "提交描述"
# 只提交指定文件或目录
svn commit /path/to/file-or-dir -m "提交指定文件"
# 指定后缀的所有文件
svn commit *.js -m "提交所有 js 文件"

update#

# 更新到最新
svn update
# 更新到指定版本的代码。特别是最新版本代码有问题时,我们可以用这个命令回到之前的版本
svn update -r xxx
# 仅更新指定文件或者目录
svn up /path/to/file-or-dir

add#

# 添加指定文件或目录
svn add /path/to/file-or-dir
# 添加当前目录下所有 php 文件
svn add *.php

delete#

svn delete /path/to/file-or-dir
# 删除版本控制,但是本地依旧保留文件
svn delete /path/to/file-or-dir --keep-local

log#

# 查看当前目录的日志
svn log
# 查看指定文件或目录的提交日志
svn log /path/to/file-or-dir
# 查看日志,并且输出变动的文件列表
svn log -v
# 限定只输出最新的 5 条日志
svn log -l 5

diff#

# 查看当前工作区的改动
svn diff
# 查看指定文件或目录的改动
svn diff /path/to/file-or-dir
# 本地文件跟指定版本号比较差异
svn diff /path/to/file-or-dir -r xxx
# 指定版本号比较差异
svn diff /path/to/file-or-dir -r 1:2

revert#

# 撤销文件的本地修改
svn revert test.php
# 递归撤销目录中的本地修改
svn revert -R /path/to/dir

ignore#

# 忽略所有 log 文件。注意最后有个点号,表示在当前目录设置忽略属性。
svn propset svn:ignore "*.log" .
# 递归忽略 global-ignores
svn propset svn:global-ignores "*.log" .
# 从文件读取忽略规则,一行一个规则。
svn propset svn:ignore -F filename.txt .
# 打开编辑器修改忽略属性
svn propedit svn:ignore .
# 查看当前目录的属性配置
svn proplist . -v
# 删除当前目录的忽略设置
svn propdel svn:ignore .

command list#

# status
svn status
svn status /path/to/file-or-dir
# cleanup
svn cleanup
# info
svn info
#ls
svn ls
svn ls -r 100
# cat
svn cat test.py -r 2
# blame
svn blame filename.php
# change svn url
svn switch --relocate old_url new_url

branches#

# 创建分支,从主干 trunk 创建一个分支保存到 branches/online1.0
svn cp -m "描述内容" http://svnbucket.com/repos/trunk http://svnbucket.com/repos/branches/online1.0
# 合并主干上的最新代码到分支上
cd branches/online1.0
svn merge http://svnbucket.com/repos/trunk
# 分支合并到主干
svn merge --reintegrate http://svnbucket.com/repos/branches/online1.0
# 切换分支
svn switch svn://svnbucket.com/test/branches/online1.0
# 删除分支
svn rm http://svnbucket.com/repos/branches/online1.0

help#

# 查看SVN帮助
svn help
# 查看指定命令的帮助信息
svn help commit
Share

If this article helped you, please share it with others!

Using SVN
https://dreaife.tokyo/en/posts/svn-tool-guide/
Author
dreaife
Published at
2024-11-04
License
CC BY-NC-SA 4.0

Some information may be outdated

Related Posts Smart
1
Blog Migration - Mizuki Configuration Records
infra A record of the migration from NotionNext to Mizuki, mainly due to NotionNext's limitations. Mizuki was chosen for its lightweight nature and good balance of features, supporting diaries and project showcases. The configuration process is simple, with content controlled via md and ts files, and it also connects to the Bangumi API. The plan is to synchronize Notion content via CI, implement multilingual support, and address the issue of image links expiring.
2
Automatically Deploy Angular Pages with GitHub Actions
infra This post explains how to configure an Angular project for automatic deployment to GitHub Pages, including modifying the outputPath in angular.json, installing angular-cli-ghpages, creating a GitHub Actions workflow to build and deploy on pushes to a specific branch, and generating the token required to access the repository. Finally, it sets the GitHub Pages branch to gh-pages.
3
Uploading Large Files to GitHub
infra To upload large files to GitHub, you need to install Git Large File Storage (LFS) and configure it in the local Git repository. The process includes installing LFS, setting up pointers to track large files, and uploading the files with the corresponding commands. After completing these steps, large files can be uploaded to GitHub successfully.
4
Getting Started with Docker
infra Docker is a technology for solving microservice deployment problems by packaging applications and their dependencies into isolated containers, avoiding inconsistent environments and dependency conflicts. Compared with virtual machines, Docker starts faster and uses fewer resources. Its architecture includes images and containers, and users can share and obtain images through Docker Hub. Basic operations include creating and managing images and containers and using volumes for data persistence and host-container decoupling. Docker Compose can simplify distributed application deployment.
5
The First Round of Selection in the New Era
life With the development of AI technology, the cost of using advanced models may lead to social stratification, where only those with strong financial means can use these models. Although current prices are still acceptable, future price increases may make them unaffordable for most people, thus forming the first round of selection. The author feels anxious about this phenomenon, while also realizing that AI applications have moved beyond programming and into broader industries. Facing the challenges and opportunities of a new world, individuals continue to explore under the momentum of the times.

Table of Contents