DevOps

SVN_Command

게임이 더 좋아 2023. 1. 21. 12:21
반응형
728x170

 

Command
Description
svn checkout "source" "destination" Check out a working copy from a repository
svn update  Update your working copy to the latest revision
svn commit -m "Commit message" "repo" Commit changes to the repository
svn add "target1" "target2" "..." Add files or directories to the repository
svn delete"source" "destination" Delete files or directories from the repository
svn status Show the status of your working copy
svn log Show the log of changes to the repository
svn diff Show the differences between your working copy and the repository
svn revert Revert changes in your working copy to the last committed version
svn copy "source" "destination" Copy files or directories within the repository or between different repositories
svn move "source" "destination" Move files or directories within the repository
svn mkdir Create a new directory in the repository
svn merge Merge changes from one branch or trunk to another
svn info "target" Show information about the working copy or a specific file or directory
svn blame Show the last person to modify each line of a file
svn switch Change the URL that a working copy tracks
svn lock -m "message" "target" Lock a file to prevent other users from committing changes to it
svn cleanup Cleanup the working copy, removing locks and resuming unfinished operations
svn resolve Resolve conflicts that occurred during an update or merge
svn propget Get the value of a property for a file or directory
svn propset Set the value of a property for a file or directory
svn propdel Remove a property from a file or directory
svn proplist List the properties of a file or directory
svn export Export a clean directory tree from the repository, without the .svn directories
svn import Add files or directories to the repository, creating an initial revision
svn cat Output the contents of a file as of a specific revision

checkout:

source로부터 파일을 가져올 때 씀

 
# source to destination
svn checkout https://example.com/svn/project /path/to/local/directory

# check out only the top-level files and directories
# --depth option can be set to 'empty', 'files', 'immediates', or 'infinity'.
svn checkout --depth=empty https://example.com/svn/project /path/to/local/directory

# check out revision 100 of the project
svn checkout -r 100 https://example.com/svn/project /path/to/local/directory

commit:

#해당 디렉토리를 repo에 올림
svn commit -m "Commit message" /path/to/local/directory

# commit only the file README.txt
svn commit -m "Updating README" /path/to/local/directory/README.txt
 

lock:

↔ unlock

 
# 해당 디렉토리를 잠금
svn lock -m "Locking file for editing" /path/to/local/directory/file.txt

# lock multiple files
svn lock -m "Locking multiple files" /path/to/local/directory/file1.txt /path/to/local/directory/file2.txt

svn lock --force -m "Stealing lock" /path/to/local/directory/file.txt

add:

#해당 directory에 repo에 추가
svn add /path/to/local/directory/new_file.txt

# add multiple files
svn add /path/to/local/directory/new_file1.txt /path/to/local/directory/new_file2

delete:

#해당 파일 삭제
svn add /path/to/local/directory/new_file.txt

# add multiple files
svn add /path/to/local/directory/new_file1.txt /path/to/local/directory/new_file2
 

copy:

# source를 destination에 복사
svn copy /path/to/local/directory/file.txt /path/to/local/directory/copy_of_file.txt

# copy multiple files - 여러 개의 파일 복사
svn copy /path/to/local/directory/file1.txt /path/to/local/directory/copy_of_file1.txt /path/to/local/directory/file2.txt /path/to/local/directory/copy_of_file2.txt

# Repository URL을 이용해서 복사 가능
svn copy https://example.com/svn/project1/file.txt https://example.com/svn/project2/file.txt -m "copying file from project1 to project2"
 

merge:

# https://example.com/svn/project/trunk 레포지터리 revision 100과 200의 변경 사항을 working directory 와 병합함
# -r 옵션은 revision을 뜻함
svn merge -r 100:200 https://example.com/svn/project/trunk /path/to/local/directory

# --dry-run 을 써서 실제 병합하지 않고 변경사항이 얼마나 만들어질지 볼 수 있음
svn merge --dry-run -r 100:200 https://example.com/svn/project/trunk /path/to/local/directory

# accept 옵션을 이용해서 Conflict 제어할 수 있음
svn merge --accept=mine-full -r 100:200 https://example.com/svn/project/trunk /path/to/local/directory
 

move:

#source에서 destination으로 옮김
svn move /path/to/local/directory/file.txt /path/to/local/directory/new_folder/file.txt
  

# move multiple files - 여러 파일 옮김
svn move /path/to/local/directory/file1.txt /path/to/local/directory/new_folder/file1.txt /path/to/local/directory/file2.txt /path/to/local/directory/new_folder/file2.txt
 

info:

# 해당 target에 대한 info를 보여줌
svn info /path/to/local/directory
  
# 파일에 대한 info도 보여줌
svn info /path/to/local/directory/file.txt

# --show-item 으로 특정한 정보도 얻을 수 있음
svn info --show-item=url /path/to/local/directory

# URL로도 정보를 얻을 수 있음
svn info https://example.com/svn/project
 

log:

#해당 디렉터리에 대한 change 히스토리를 보여줌
svn log /path/to/local/directory

#파일, 디렉토리 둘다 됨
svn log /path/to/local/directory/file.txt

#tail 5개만 보여줌 -> 최근 5개
svn log -l 5 /path/to/local/directory

#-r 옵션으로 리비전 간의 log를 볼 수 있음
svn log -r 100:200 /path/to/
 

status:

# target의 status를 보여줌
svn status /path/to/local/directory

#파일의 status를 보여줌
svn status /path/to/local/directory/file.txt
 

Status들은 아래와 같음

?: files that are not under version control

A: files that have been added to version control, but not yet committed

D: files that have been deleted from version control, but not yet committed

M: files that have been modified and need to be committed

C: files that are in a conflicted state

diff:

#현재 {directory}에서 작업하는 것과 Repo의 {directory}에서 작업하는 것의 차이점을 보여줌
svn diff /path/to/local/directory

#해당 파일의 차이점을 보여줌
svn diff /path/to/local/directory/file.txt

#revision 간의 차이점을 보여줌
svn diff -r 100:200 /path/to/local/directory

#change 내역을 summarize 해서 보여줌
svn diff --summarize /path/to/local/directory

# 외부 diff 툴을 이용할 수 있음
svn diff --diff-cmd=meld /path/to/local/directory

blame:

annotation과 같은 추가 정보

수정 내역을 볼 수 있음

 
#해당 file의 정보 볼 수 있음
svn blame /path/to/local/directory/file.txt

#revision 사이의 내역 정보를 볼 수 있음
svn blame -r 100:200 /path/to/local/directory/file.txt

#revision 번호까지 나옴
svn blame -v /path/to/local/directory/file.txt

#graph와 같이 나옴
svn blame -g /path/to/local/directory/file.txt

import:

 
#해당 repo의 해당 directory를 import 할 수 있음
svn import /path/to/local/directory https://example.com/svn/project -m "Initial import"
  
#디렉토리 자체를 recursive 하게 가져옴
svn import -N /path/to/local/directory https://example.com/svn/project -m "Initial import"

#global-ignores pattern과 매치되어도 가져옴
svn import --no-ignore /path/to/local/directory https://example.com/svn/project -m "Initial import"

export:

# source를 destination에 export함 (a clean directory tree of the repository)
svn export https://example.com/svn/project /path/to/local/directory

#revision을 이용해서 export 가능
svn export -r 100 https://example.com/svn/project /path/to/local/directory

#--force는 덮어쓰기를 허용함
svn export --force https://example.com/svn/project /path/to/local/directory

list:

#해당 디렉토리를 리스트 형태로 보여줌
svn list https://example.com/svn/project

#같음
svn list https://example.com/svn/project/trunk

#recursive 하게 보여줌
svn list -R https://example.com/svn/project

#해당 revision 보여줌
svn list -r 100 https://example.com/svn/project
 
728x90
반응형
그리드형

'DevOps' 카테고리의 다른 글

Redis 백업  (1) 2023.07.08
Logging Application 비교  (0) 2023.01.21
CDN, Content Delivery Network - 2  (0) 2022.11.27
CDN, Content Delivery Network - 1  (0) 2022.11.27
Source tree, 소스트리로 형상관리 쉽게 하기  (0) 2022.11.12