Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學
您现在的位置: Windows教程網 >> Windows教程 >  >> Linux 系統教學 >> Linux 教學

Linux 命令行 SVN 操作全攻略:從 Checkout 到分支合併常用命令

編輯:Linux 教學

1. 检出代碼

svn checkout https://svn.example.com/repo/project  # 完整
svn co https://svn.example.com/repo/project        # 簡寫

2. 添加新文件到版本庫

svn add test.php           # 單文件
svn add *.php              # 批量添加當前目錄所有 php

3. 提交修改

svn commit -m "修改描述" test.php
svn ci -m "修改描述"       # 簡寫,提交當前目錄所有變更

4. 加鎖/解鎖(獨占編輯)

svn lock -m "鎖定原因" test.php
svn unlock test.php

5. 更新到指定版本

svn update                    # 更新到最新版
svn update -r 200 test.php    # 將文件恢復到版本 200
svn up                        # 簡寫

衝突處理:提交前先 svn up,衝突文件標記為 C,手動解決後 svn resolved 文件,再 commit。

6. 查看狀態

svn status            # 簡略狀態:? 未受控、M 修改、C 衝突、A 待加入、K 鎖定
svn status -v         # 顯示版本號、最後修改版本、修改人
svn st                # 簡寫

離線可用:status、diff、revert 不需網絡(本地 .svn 保存基礎版本)。

7. 刪除文件

svn delete test.php
svn ci -m "delete test file"
# 或直接指定倉庫 URL 刪除
svn delete https://svn.example.com/repo/test.php -m "delete"

簡寫:svn del、svn rm、svn remove。

8. 查看日志

svn log test.php        # 文件完整修改歷史

9. 查看文件詳細信息

svn info test.php

10. 比較差異

svn diff test.php               # 與基礎版本比較
svn diff -r 200:201 test.php    # 比較版本 200 和 201
svn di                          # 簡寫
Copyright © Windows教程網 All Rights Reserved