Jenkins 常用 SVN 指令 (整理)

通常 Jenkins 設定好一次就很少動它, 不常下指令的我怕忘記所以整理在這 (做小抄).

Build 相關

1. 更新

svn update
svn update [-rxxx]

加入 -rxxx 表示更新到指定 revision. 不加直接更到最新.

2. 還原

svn revert [-R] [directory]
svn revert [file]

還原的目標是目錄的話, 要加上 -R 表示 recursive.
不加的話, 是底下的目錄都還原.

3. 提交

svn commit [-m] [xxxx]
svn commit [-m] [xxxx] [file]

提交當前已修改所有內容 (under version control) or 指定檔案, 並附上 message log.
如果是新增的檔案要先 add 後才能提交上.

Branch 相關

1. 複製 (備份用)

svn copy [source_remote_path@xxx] [target_remote_path] [-m] [xxxx]

複製來源路徑到指定路徑目錄下, 來源路徑可指定 revision.

2. 刪除 + 提交

svn remove [file/directory]

刪除目標目錄或檔案, 記得在提交.

3. 切換

svn switch [target_remote_path] [source_local_path]

切換本地指定目錄的 svn repo.
分支建立後, 在本地端複製一份主線目錄, 在把複製的目錄切換 svn repo 到分支上. 有時候比重新 checkout 一份分支還快.

4. 搬遷

svn relocate [target_remote_path] [source_remote_path]

切換 svn repo 位置到另一個 repo.
通常是 svn 搬家會用到, 屬於 server side 操作.

參考

1. svn update https://svnbook.red-bean.com/en/1.8/svn.ref.svn.c.update.html

2. svn commit https://svnbook.red-bean.com/en/1.8/svn.ref.svn.c.commit.html

3. svn switch https://svnbook.red-bean.com/en/1.8/svn.ref.svn.c.switch.html

4. svn switch vs. relocate https://stackoverflow.com/questions/1816629/svn-relocate-or-switch

發表留言