Answer the question
In order to leave comments, you need to log in
Compare and merge code?
There is some functionality in the project that was implemented through copy-paste. Depending on the specific ID, the functionality is slightly different, but generally similar. Why those who developed it before me did it through copies - I don’t know. This is from the indocode area. Decided to refactor.
Accordingly, after combining, the unique code will be enclosed in if
s and executed depending on the ID.
So. There are 20 files with JS code. The structure is generally the same, many files are identical, some differ only slightly, some to the point of missing some functionality. Accordingly, to combine them into one, you need to go through each and see if there are certain functions or even lines in each of the files. By the way, it is possible that later you will also have to compare the server code.
While I started to do everything manually, but I was not very enthusiastic.
Question. Is it possible to somehow simplify and automate this task? And if so, by what means and methods?
A simple comparison is not suitable, since only two files are compared, in some lines or entire functions may be rearranged. And in general, you need to keep in mind all the files at once, and not just two with each other.
A negative answer is also an answer, if you are sure of it.
Answer the question
In order to leave comments, you need to log in
As a result, I did everything manually, using the usual tool for comparing texts, because otherwise it is unrealistic.
Thanks to everyone for the answers, incl. for Araxis Merge.
In general, almost any IDE can compare files (NetBeans, WebStorm definitely can). You can also use third party diff tools .
Araxis Merge has a three-file comparison mode. Source, and two edits, and you can merge edits into one. Very handy for merging.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question