Preface:
As a team developer, version control tools such as SVN are indispensable. Some days ago, due to the nonstandard use of SVN, many unnecessary troubles were caused, then I spoke up in the QQ space and caused a lot of people to argue. Many technical experts also expressed their views that "rules are better than configuration", but as a user, it is necessary to clarify the principles of various scenarios, so as to benefit others.
Scenario 1: file operations by a single user
:
The first story is as follows:
Reliable brother wants to open a store to marry Bai fumei and embark on the peak of his life! So he started (better than you, so he acted, haha)
1. First, he prepared some materials, such as configuration on SVN. The basic file version is v01.properties.
2. He later wanted to modify the configuration file and add some content, so he did the following operations:
Step 1: obtain the basic version v01.properties from SVN to the local device;
Step 2: Modify the data locally based on v01.properties and save the modification to the local device. The local name is k02.v01. properties. (SVN thinks this will be an upgraded version of v01.properties, locally called k02.v01. properties, where k = kaopu (reliable), 02 = 01 of the next version, v01 = modified based on v01)
Step 3: The reliable elder brother updates it first, and no SVN version is found to be newer than the local basic version v01.properties, so SVN does not need to be merged;
Step 4: commit data. SVN creates a new official version on the database: v02.properties.
3. Reliable and successful data modification
The first story describes a complete SVN download base version --> local file modification based on the base version --> check whether there is a new version on the svn database before submission --> submit the modified file, generate a new version in the svn repository.
Scenario 2: two people operate on the same file
:
The second story is as follows:
Reliable brother wants to open a store to marry Bai fumei and embark on the peak of his life! He thought it was boring to work alone, so he called to stay and forced his friends to work together (reliable and awesome, even if you want to lose money, but also drag the foundation friends into the water, unreliable)
Step0: Time-Space reversal. It is the case that only one version of the svn database is returned. For example, if you have prepared some documents (Why are you so surprised? I won't tell you );
Reliable thinking: "Well, this time we need to design a niub's URL. The URL is a unified resource positioning. It is very important. It cannot be the same as the previous one, huh? Why did I say that the last time I reversed the time and space? Well, no matter what it is (how silly and reliable )"
Little talk, reliable brother operation (history is always amazing, Ah operation actually come again ):
Step 1: obtain the basic version v01.properties from SVN to the local device;
Step 2: Modify the data locally based on v01.properties and save the modification to the local directory named k02.v01. properties.
Step 3: The reliable elder brother updates it first, and no SVN version is found to be newer than the local basic version v01.properties, so SVN does not need to be merged;
Step 4: Create a new official version v02.properties on the repository of Svn in commit.
Zai Ge is also a strong guy. I came back from work one day and got tired and tired. I didn't have enough time to watch movies. I finally agreed to break through the store together.
I checked the svn database as soon as I reversed the space and time (this is an occupational disease). This is also the only asset, the result shows that the store in the basic version is actually a reliable brother.
Follow these steps:
Step 1: obtain the basic version v01.properties from SVN to the local device;
Step 2: Modify the data locally based on v01.properties and save the modification to the local directory named z02.v01. properties;
Step 3: update the svn file first and find that the svn file is stored in v02.properties, which is later than the local basic version v01.properties. So what does SVN need to do;
SVN thinking: it is unreasonable for you to modify v01.properties Based on v02.properties. You should modify v02.properties based on it, but all the modifications have been completed. It seems that you have only helped me merge the changes. Row 1: No problem, no change; Row 2: The reliable elder brother hasn't changed, so let's change it according to your elder brother; Row 3: I don't even know the existence of Row 3, so I will add it to him; After modification, save it to z03.v02. Properties |
Step 4: commit the commit data. SVN submits z03.v02. properties from the local client to the svn repository to form a new official version v03.properties (). The modification is successful;
The second story is over, and the two students have done a tacit modification to the same file;
Scenario 3: The two operate on a file conflict at the same time
:
The third story is like this:
Reliable brother wants to open a store to marry Bai fumei and embark on the peak of his life! He thought that the two men did not have enough money, so he dragged ximei down again.
Step 0: Time-Space reversal. It is the case that only one version of the svn database is returned again. For example, you have prepared some documents;
I still want to be a manager. As a result, ximei has the same idea.
The operations are as follows:
Step 1: obtain the basic version v01.properties from SVN to the local device;
Step 2: Modify the data locally based on v01.properties and save the modification to the local directory named z02.v01. properties.
Step 3: update the SVN version. The optimal version of SVN is still v01.propertie, so SVN does not need to do anything;
Step 4: commit data, SVNZ02.v01. properties is submitted to the svn repository to form a new official version v02.properties (). The modification is successful.;
Ximei's operations are as follows:
Step 1: obtain the basic version v01.properties from SVN to the local device;
Step 2: Modify the data locally based on v01.properties and save the modification to the local directory named x02.v01. properties;
Step 3: ximei first updates and finds that the optimal version of SVN is not v01.properties but v02.properties. So what does SVN need to do;
SVN began to think about it again: ximei's modification based on v01.properties is unreasonable. ximei should be modified based on v02.properties, but he has already completed the modification. It seems that only I have helped him merge the changes. Row 1: No problem, no change; Row 2: I actually changed my sister-in-law (from the store manager to the reliable brother --> Zai Ge) and ximei (from the reliable brother-> ximei ); How can I change the store key after it is finished ???? I don't care about SVN.
|
Step 4: SVN provides a prompt for conflict;
The third story is over. In the story, I learned that the last manager was a reliable manager and asked me to be the next manager. My colleague ximei also got the basic version, I learned that the last store manager is a reliable elder brother, and I also want to be the next store manager. As a result, the two men started fighting. SVN said it was very difficult. In fact, the last store manager was also very difficult;
Summary of the third story: In fact, I got the information of the last store manager from my brother and sister-in-law colleagues. Unfortunately, I had the experience of the second story (not to say I had a time-space reversal problem, mao's experience can be discussed ...) modified the information in time and submitted it in time! Ximei still made modifications on the basic version, but she had no idea that she had been on the top of the system for a long time. This made it very difficult for the eunuch (SVN) to tell you the conflict. The previous changes were in vain. Of course, before the modification, ximei obtained the latest version, but it was a pity that her hands and feet were slow. She was first placed on the throne and changed to another generation. At this time, ximei again came to the upper level with the sacred decree of the previous dynasty, we don't admit it, but everyone is a qualified person. You can't submit it directly. This way, the history of your brother is buried. If ximei wants to go to the upper level, she must first discuss it with the current store manager. If she agrees, ximei can go to the upper level.
Scenario 4: complicated stories...
:
After listening to so many stories, let's leave this story to the audience.
First blog Summary
The article is a little messy, and the plot is also jumping. The road lies in the line. After the line is done, you can only get the road. Please pat the bricks. The next time I want to write a clear line of thinking, I want to know the follow-up stories of reliable brother, zai Ge, and ximei, and I will explain it again next time.
SVN usage, merge, and conflict details