Which SCM / VCS is good at moving text between files?

We have problems with our project at work because our VCS is doing some awful merge as we move information through files.

So the script:

You have many files that, say, contain information about terms from a dictionary, so you have a file for each letter of the alphabet.

Users entering conditions are blindly following the order of the dictionary, so they will put a "kick the bucket" entry under B if that's where the dictionary listed it (or perhaps it was listed for both B and B, bump) ...

Later, other users will move the terms to their correct files. A lot of time is spent on vocabulary terms.

eg. User A may have picked up file B and elaborated on the "kick the bucket" entry. User B took files B and K and moved the "kick the bucket" entry to file K. Whichever order they go, VCS is likely to lose the entries, rather than "figure out" that the entry was moved.

(These records are later automatically converted to a SQL database, but they are stored in a "human-friendly" form to work with, with a lot of comments, examples, etc. Therefore, it is not acceptable to say "make your users" enter SQL directly ". )

It's so bad that we have now almost manually stitched these files together because we cannot trust our VCS. :(

So what's the solution? I would love to hear that there is a VCS that could handle this. Or a better merge algorithm? Or else, maybe someone can suggest a better workflow or filesystem to try and avoid this problem?

+2


source to share


1 answer


I would recommend:

  • using branching (so the commit order doesn't matter: each developer writes their own set of changes to their own branch)
  • consolidate branches on upstream "dico" where conflicts can be resolved.

( Git is especially good at this)


You can quickly test it:

C:\test\git>mkdir dico
C:\test\git>cd dico
C:\test\git\dico>git init
Initialized empty Git repository in C:/test/git/dico/.git/
C:\test\git\dico>echo words for B> B.txt
C:\test\git\dico>echo words for K> K.txt
C:\test\git\dico>git add -A & git commit -m "first letters"
[master (root-commit) e91d6fa] first letters
 2 files changed, 2 insertions(+), 0 deletions(-)
 create mode 100644 B.txt
 create mode 100644 K.txt

      

You have an empty dico on your master branch.
DevA:

C:\test\git\dico>git checkout -b devA
Switched to a new branch 'devA'
C:\test\git\dico>echo Kick the Bucket: my def from devA>>B.txt
C:\test\git\dico>type B.txt
words for B
Kick the Bucket: my def from devA
C:\test\git\dico>git add -A & git commit -m "def from devA"
[devA 0f27595] def from devA
 1 files changed, 1 insertions(+), 0 deletions(-)

      

DevB comes in and gets devA work:

C:\test\git\dico>git checkout master
Switched to branch 'master'
C:\test\git\dico>type B.txt
words for B
C:\test\git\dico>git checkout -b devB
Switched to a new branch 'devB'
C:\test\git\dico>git merge devA
Updating e91d6fa..0f27595
Fast forward
 B.txt |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

C:\test\git\dico>type B.txt
words for B
Kick the Bucket: my def from devA

      

Oh no! Wrong place for this definition!



C:\test\git\dico>echo words for B>B.txt
C:\test\git\dico>echo Kick the Bucket: my def from devA>>K.txt
C:\test\git\dico>git add -A & git commit -m "move def to K by devB"
[devB 473614d] move def to K by devB
 2 files changed, 1 insertions(+), 1 deletions(-)

      

Fix in devB branches. DevB continues:

C:\test\git\dico>echo add to def by devB>>K.txt
C:\test\git\dico>git add -A & git commit -m "elaborate def by devB on K"
[devB f9ae17d] elaborate def by devB on K
 1 files changed, 1 insertions(+), 0 deletions(-)

      

Meaning, in the devA branch, devA is also working on this definition:

C:\test\git\dico>git checkout devA
Switched to branch 'devA'
C:\test\git\dico>type B.txt
words for B
Kick the Bucket: my def from devA
C:\test\git\dico>type K.txt
words for K

      

C: \ test \ git \ dico> echo elabore def from devA to B → B.txt

C:\test\git\dico>type B.txt
words for B
Kick the Bucket: my def from devA
elabore def from devA in B

C:\test\git\dico>git add -A & git commit -m "devA go on on B.txt"
[devA 1da899a] devA go on on B.txt
 1 files changed, 1 insertions(+), 0 deletions(-)

      

If devB verifies that devA is working, it will detect a conflict and resolve accordingly:

C:\test\git\dico>git checkout devB
Switched to branch 'devB'

C:\test\git\dico>git merge devA
Auto-merging B.txt
CONFLICT (content): Merge conflict in B.txt
Automatic merge failed; fix conflicts and then commit the result.

C:\test\git\dico>git diff
diff --cc B.txt
index 1cc6ea9,a986721..0000000
--- a/B.txt
+++ b/B.txt
@@@ -1,1 -1,3 +1,6 @@@
  words for B
++<<<<<<< HEAD
++=======
+ Kick the Bucket: my def from devA
+ elabore def from devA in B
++>>>>>>> devA

      

It will remove the extra definition from B.txt and add it to the K.txt file (and then go to devA and tell him / her to STOP, merge his work and continue in the correct file!)

+4


source







All Articles