I was not familiar with SVN before, I was afraid to die when I met the conflict, and I didn't know how to deal with it. We must look squarely at this problem today and study it.
First, conflict
SVN is very smart, unlike VSS, where a person must check out the file in an exclusive way, causing others to not be able to modify it. Instead, it allows multiple people to modify a file at the same time. This greatly reduces the problem of resource competition, before using VSS often asked colleagues: "After the change, check in."
1. How the conflict occurred
- Two people modified different files? There will be no conflicts, because they are not relevant.
- Two people change different locations of the same file at the same time? There is no conflict, and SVN solves the problem nicely.
- Two people also modified the same file in the same location? This is a time of conflict.
Scenario: Engineer a modified the first line of the a.txt and submitted it. Engineer B also modifies the first line of A.txt, and then uploads it, when SVN prompts for a conflict.
Let's recreate this scene. First, we create 3 folders, one server and two clients. SVN associates them. Then upload 1 a.txt up.
At the same time in two folders, open and modify the A.txt file.
After the changes are complete, the folder prompts for files that are not uploaded:
Upload client1, no problem, turn green directly. But when uploading client2, SVN prompts the a.txt file to expire.
At this point, to regain the Client2 folder, if SVN found that the A.txt file modification is not the same line, then there is no problem, but unfortunately, here we have modified the first row of two folders.
SVN prompt conflict, folder becomes "yellow exclamation mark".
2. Conflict resolution
We chose to edit the conflict:
At this point, the right button on one side will have the following options for us to choose from:
1, Use the This text block: using this chunk;
2, use the This whole file: using this document;
3, use the text block from ' mine ' before ' theirs ': merge, put my changes before others change;
4, use the text block from ' Theids ' before ' mine ': merge, put other people's changes before my changes;
The above 4 options, after clicking on the bottom of the textarea will see the final effect, select the desired version is OK.
If you are dealing with each other, you can choose to jump to the previous/next conflict place:
It's done, it's OK to mark the conflict as resolved.
second, SVN ignores the file
In the project, some files may not need to be managed by SVN, because some files may change every time the build, such as the bin directory. Consider ignoring these directories from SVN management without having to update these files every time you comit. Here's how it works:
1. Ignore a file in svn:
2, ignore, if submitted, at this time the server will delete the file, its icon appears as follows:
3, if you want to add the ignored files back:
Generally speaking, a. NET Web project, the following folder is not required to be added to SVN management:
- Bin folder;
- Obj folder;
- *.user file;
- . suo file;
SVN records conflicts, ignores