Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

What are some examples of version control systems that work on files and on lines of files?

In my understanding, a control system that works on file is able to automatically manage merges whenever there are no file conflicts:

for example:

A,B,C --> A',B',C
| (branch)  ___________ (merge) -> A',B',C'  
 -------> A,B,C'  

In what cases a version control system that work on lines is able to manage merge by itself and in what other cases it asks the developer to solve them?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
277 views
Welcome To Ask or Share your Answers For Others

1 Answer

Your questions is too broad/generic but I'll try to give a shot anyways.

Most merge strategies in modern Version Control Systems, can't deal with the following:

Suppose you have files A B C in commit 001 in a repository.
Developer Dev1 branch of commit 001 and changes one line in file A, commits as 001a.
Developer Dev2 branch of commit 001 and changes the same line in file A and commits as 001b.

If someone wants to merge commits 001a and 001b, the merge system wouldn't be able to tell which is the correct change for the line, maybe the correct change for the project would be using the content in commit 001a or maybe the one in commit 001b, or maybe even mix of both changes in the line (that someone would have to create).

That's usually how you get a conflict that need manual intervention, because two developers are working in the same file and line and wrote different changes.

In the rest of the cases the result is obvious:

  • No changes in either commit? No changes in the merge result.
  • Changes in either of the commits? The change is applied in the merge.
  • Changes in the same file but different lines (for example, two devs working in different methods)? Both changes are applied in the merge.

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...