当前位置:网站首页>Svn learning

Svn learning

2022-07-19 10:53:00 Winter dream chaser

SVN Study

SVN Introduce

Subversion For short , It's an open source version control system , Branch management system was adopted .

Basic concepts

  • repository( Source code library ): The place where the source code is stored , Beihui Redmine Each project in is a separate warehouse
  • checkout( extract ): from repository Pull code from to local commit( Submit ): After the code changes , need commit To repository
  • update( to update ): checkout After the source , If someone else changes the code in the process , need update The latest code

Workflow

Create a version Library redmine Automatically create a new project
Check out the mkdir –p /work/projectssvn co http://svn.polelink.com/repos/xxx
to update
Implement changes
Review changes
Fix errors
Resolve conflicts
Submit changes

 Insert picture description here

Check out the project

svn co http://svn.polelink.com/repos/xxx

Project status

svn st ( You can add a specific path later )svn st –q: Only local changes , And exist in the warehouse , New files will not be displayed , Unchanged ones are not displayed

 Insert picture description here

A: newly added , When a new file is created , perform svn add xxx After the show for A, Otherwise, it will be displayed as ?

C: Conflict , There is a conflict between the local modification and that in the warehouse

D: Delete , perform svn del xxx After the show for D

M: Local has changed

?: Not under version control , That is, there is no such file or directory in the warehouse

!: Loss , unexecuted svn del, Directly delete the file or directory in the file system

L: lock , When the operation is disconnected or forcibly suspended, etc , or svn lock After the command

I: Ignore

R: Replace

X: Directories not included in version control , Created by an externally referenced Directory

SVN Common commands

Code check out checkout

  • This order will put SVN The code on the server is downloaded to our computer ,checkout Or we could just write it as co
svn checkout svn://svnbucket.com/xxx/xxx
#  Specify the storage directory 
svn checkout svn://svnbucket.com/xxx/xxx save-dir
#  Specify user name and password .
svn checkout svn://svnbucket.com/xxx/xxx --username xxxx --password xxx

Submission code commit

  • This command can submit our local modifications to SVN The server , So that other colleagues can update our code .
    commit I could just write it as ci,-m The parameter is followed by the description of this submission
#  Description is necessary , But you can fill in an empty string , Don't specify 
svn commit -m " Submission description "
#  Submit only specified files or directories 
svn commit /path/to/file-or-dir -m " Submit the specified document "
#  Specify all files with suffixes 
svn commit *.js -m " Submit all  js  file "

Update code update

  • Executing this command will change the code submitted by others from SVN The server is updated to our own computer ,update Or we could just write it as up
#  Update to the latest 
svn update
#  Update to the specified version of the code . Especially when there is a problem with the latest version of the code , We can use this command to go back to the previous version 
svn update -r xxx 
#  Only update the specified file or directory 
svn up /path/to/file-or-dir

Add files add

  • New file , We need to use add Order them to be added SVN Version management , Then we can submit it .
    Be careful : You need to submit after adding .
#  Add the specified file or directory 
svn add /path/to/file-or-dir
#  Add all... In the current directory  php  file 
svn add *.php

Delete file delete

  • This command will start from SVN Remove version control , After removal, you need to submit
svn delete /path/to/file-or-dir
#  Delete version control , But files are still kept locally 
svn delete /path/to/file-or-dir --keep-local

Check the log log

#  View the log of the current directory 
svn log
#  View the submission log of the specified file or directory 
svn log /path/to/file-or-dir
#  Check the log , And output the list of changed files 
svn log -v
#  Limit the output to the latest  5  Logs 
svn log -l 5

View changes diff


#  View the changes in the current workspace 
svn diff
#  Check the changes of the specified file or directory 
svn diff /path/to/file-or-dir
#  The local file is different from the specified version number 
svn diff /path/to/file-or-dir -r xxx
#  Specify version number to compare differences 
svn diff /path/to/file-or-dir -r 1:2 

Undo modify revert

#  Undo the local modification of the file 
svn revert test.php
#  Recursively undo local modifications in the directory 
svn revert -R /path/to/dir
原网站

版权声明
本文为[Winter dream chaser]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/200/202207171324492893.html