Using Git to update one file with the changes made to a second file -


I'm new to git; I know basic commands, but I am not familiar with the optimum way of organizing projects.

I have two versions of a file which do almost the same thing, the only difference in the two files is that they scan a particular file, and the differences are limited to one area of ​​code. As I've added functionality for one, I can only copy and paste the same change in the second file, but I think it's easy to make a good version control.

My best estimate is that I want to create a second branch (e.g., 'branch_B') and keep a copy of the branch with the same name with a branch of both the branch and branch_ (so They can be easily merged). But then, when I merge, will not I end up with an odd combination of two files in the master branch, instead of the updated version of the second file?

Avoiding duplication of code should refactor your code. Version control does not mean an option for this.

Git can efficiently store duplicate content, but this is not the point. Once you check the code from the repository in your work tree, you still have a duplicate code to work on. Using your version control tool in this way is not making anything more capable for you.

See:


Comments