【SVN】Basic operations of SVN on Windows system (checkout, update, commit, branch merge branch, restore, create conflict and resolve conflict, ignore)

introduce

This is the journey of the editor's growth path, and also the editor's learning path. Hope to grow up with you guys!

Here are two of my favorite quotes:

To have the most simple life and the most distant dream, even if it will be cold tomorrow, the mountains will be high and the water will be far away, and the road will be far away.

Why should one work hard? The best answer I have ever seen is: because the things I like are expensive, the places I want to go are far away, and the person I love is perfect. Therefore, the editor would like to say: encourage each other!

Table of contents

1. Detection

2. Submit

 3. Update

4. Create conflict and resolve conflict

1. Create conflict

 2. Resolving conflicts

method one:

Method Two:

Method three:

Method four:

3. How to reduce the complexity of conflict resolution

 Five, branch merge branch

1. Create a branch

 Create the main program.txt in the trunk and submit it 

create branch

Go to the branch branches to update

 2. Merge branches

 Merge branch in main program

6. Restoration

Seven, ignore


1. Detection

Right click on the desktop or a blank page

Because the editor has already logged in with the account under the server address, so clicking OK will not show the next step.

If it is the first checkout, the following page will appear

 After completing the above steps, the following page will appear

( If the icon does not appear, you can go to another blog of the editor [SVN has been resolved] svn download success icon does not display the solution_determine ZandR's blog-CSDN blog )

Note: If you are performing other operations (except for the first checkout) and the svn icon does not appear, you can return to the previous level, and the icon will appear when you come in

2. Submit

 Create a text document under this folder, because it is a case now, and it is not time to actually do the project, so it is free to create a file in this place (when doing a real project, the name of the file here cannot be Chinese , so when doing cases, you can try to be as standard as possible, so that you will not make low-level mistakes when doing projects)

Right-click the blank page or select the file to submit ( select the file to submit to submit this file, click the blank page to submit to submit all unsubmitted files )

After completing the above steps, the submission is successful!

If the submission is successful, the following interface will appear, and the a.txt just submitted will also have a green svn icon 

 

 3. Update

Update can update the code submitted by your partner ( in the actual project, it is two different computers and two different people , because it is a case demonstration, use two different folders or different accounts to submit and update, Xiaobian demonstrates here Use two different folders to submit and then update ) Repeat the checkout steps to create a folder svn-test02

 Create b.txt c.txt in two folders respectively

 Commit in two folders separately

 You can see that the files in the two folders in the above figure are different, and then update them in the two folders respectively, so that the files in the two folders are the same, as shown in the figure below:

 After completing the above operations, the update operation can be completed (you can update all the companion codes to your own folder)

4. Create conflict and resolve conflict

The editor also uses two different folders as the update above (in the actual project , two people (two computers) operate the same file to conflict)

1. Create conflict

Write 1111111 in c.txt of test02 

 Write 222222 in c.txt of test01

Submit test02

 Update test01

 An error occurs when the update is complete

 The following file will appear 

c.txt.mine The code to add content under your current folder

The initial version of c.txt.r22 before adding content to this folder

c.txt.r23 The code that conflicts with you is also the updated version of the server (your partner also modified this code, and then you modified it without updating it, and the conflict will occur if you update it after modification)

 2. Resolving conflicts

method one:

Discard your own updates, use file revert, and commit. In this way, there is no need to use svn resolved (resolve) (remember to back up your own code before restoring)

Method Two:

Abandon your own update and use someone else's update. Overwrite the target file with the latest fetched version, and commit

 You can check the log to see the version you need

Click to display the log in the above picture, you can choose the version you need

And then keep clicking OK!

Method three:

Manual resolution: When a conflict occurs, after communicating with other users, click Resolve to manually update the target file, and then submit.

Right click on the conflicting file with the exclamation triangle


 

 

After completing the above operations, the same picture will appear as shown below, which means that the conflicting files are gone.

 Click into c.txt and you can see the content like garbled characters in the image below

 Remove the garbled characters (>>>>>>> is the place that represents the conflict), save and submit

Test02 performs svn update, so that the c.txt files on both sides are the same, as shown in the figure below:

 

Method four:

Click to resolve conflicts

Click to resolve conflicts, the following interface appears

 

 

When you look at the test01 file again, the following picture will appear

 

Click to see, there are no garbled characters, no error prompts, and the modified content on both sides is inside

 

 click submit

 Then update it in test02, and finally the following interface will appear

 Represents conflict resolution, the above are the four methods of conflict resolution

The following are the meanings of some icons of svn

3. How to reduce the complexity of conflict resolution


1. When the document editing is completed, submit it as soon as possible. Frequent submissions/updates can reduce the probability of conflicts and the complexity of resolving conflicts when they occur.

2. When submitting, write a clear message, so that you can find the reason for the user's update in the future. After all, as time goes by, the reason for the original update may be forgotten

3. Develop good usage habits. When using SVN, submit first and then update. After opening it every morning, the first thing to do is to get the latest version from the repository. All edited documents must be submitted to the repository before get off work every day.
 

 Five, branch merge branch

Trunk trunk (trunk) branches branch (branch) tags label (whole tree) tags label (whole tree)


Trunk is used for mainline development.
Branches are used for custom versions, bug fixes, parallel development, etc.
Tags are used to store release versions and phased codes, not for modification and commit [backup]


Branches are used to customize versions, fix bugs, parallel development, etc. Use tags to store release versions, phased codes, not for modification and commit [backup]

During the development of branches, it is necessary to update from trunk to branches from time to time for synchronization

When the development of the branches is completed, the branches can be re-merged into the trunk

 Select in test01 or in test02

The editor chooses to conduct case operations in test01

1. Create a branch

 

Click on blank page to submit

 

 Create the main program.txt in the trunk and submit it 

create branch

 

 

 

 

Go to the branch branches to update

 

 

 2. Merge branches

Enter the content in the main program branch one in the branch branches

 save and submit

 Merge branch in main program

Right-click the main program in the truck and select Merge

 

 

 

 

Submit after the merge is complete, and then click into the main program to see the content entered in branch 1

 

 After completing the above operations, branching and merging branches are almost completed

6. Restoration

input in a file

It will be displayed in red, indicating that it has been modified.

Right click on the file and select SVN Restore 

Last display unmodified content

 The above steps are the restore operation

Seven, ignore

Ignore the upload of the file, the modified or newly created file can be ignored, so there is no need to submit, and there is no svn icon

 Remember to submit after ignoring

After modification, repeat the above operation to ignore

The above is the content of the editor's practice, I hope it can help everyone, thank you for watching! ! !

Guess you like

Origin blog.csdn.net/weixin_60387745/article/details/130350509