Linux command
svn 命令
文件
复制后可按需替换文件名、目录或参数。
常用示例
Checkout a repository
svn checkout [url] [path/to/directory]
Update the working copy
svn update
Add a file
svn add [path/to/file]
Commit changes
svn commit -m "[message]"
Show the status
svn status
Show differences
svn diff [path/to/file]
View the commit log
svn log [path]
Revert local changes
svn revert [path/to/file]
说明
svn is the official command-line client for Apache Subversion, a centralized version control system. It manages files and directories over time, tracking modifications and allowing retrieval of previous versions. The client communicates with a Subversion repository to perform operations like checking out working copies, committing changes, updating to latest revisions, and merging branches. Subversion supports atomic commits, versioned directories, and efficient binary file handling. Working copies maintain metadata in .svn directories, tracking the base revision and local modifications. The svn client uses this metadata to determine what has changed and what needs synchronization with the repository.
参数
- checkout (co)
- Check out a working copy from a repository.
- update (up)
- Bring changes from the repository into the working copy.
- add
- Put files and directories under version control.
- delete (del, rm)
- Remove files and directories from version control.
- commit (ci)
- Send changes from your working copy to the repository.
- status (st)
- Print the status of working copy files and directories.
- diff (di)
- Display local modifications or differences between revisions.
- log
- Display commit log messages.
- revert
- Undo local modifications to a file or directory.
- merge
- Apply differences between two sources to a working copy path.
- copy (cp)
- Copy a file or directory in a working copy or repository.
- move (mv)
- Move or rename a file or directory.
- info
- Display information about a local or remote item.
- blame (annotate)
- Show author and revision information inline for each line.
- -m, --message _msg_
- Specify a log message for the commit.
- -r, --revision _rev_
- Specify a revision number or range (e.g., -r 100, -r 100:200).
- -c, --change _rev_
- Apply change from revision (syntactic sugar for -r rev-1:rev).
- -q, --quiet
- Print nothing, or only summary information.
- -v, --verbose
- Print extra information.
- --depth _arg_
- Limit operation scope: empty, files, immediates, or infinity.
- --username _user_
- Specify a username for authentication.
- --password _pass_
- Specify a password for authentication.
- --non-interactive
- Do no interactive prompting (useful for scripts).
FAQ
What is the svn command used for?
svn is the official command-line client for Apache Subversion, a centralized version control system. It manages files and directories over time, tracking modifications and allowing retrieval of previous versions. The client communicates with a Subversion repository to perform operations like checking out working copies, committing changes, updating to latest revisions, and merging branches. Subversion supports atomic commits, versioned directories, and efficient binary file handling. Working copies maintain metadata in .svn directories, tracking the base revision and local modifications. The svn client uses this metadata to determine what has changed and what needs synchronization with the repository.
How do I run a basic svn example?
Run `svn checkout [url] [path/to/directory]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does checkout (co) do in svn?
Check out a working copy from a repository.