Search code examples
gitworkflow

GIT - Benefits compared between merge vs copy into master branch


What are advantages/disadvantages to a workflow with merging to a master branch? And what are reasons to work in a local branch and afterwards directly copy work into master-branch (without merging).


Solution

  • I think merging would be a better option than copy pasting the code.

    1. The most important reason for this is that there is a maintenance of a good history of the project. Git will help you in maintaining a history of ALL the merges and commits whereas in case of a copy-paste, a developer may paste the code, make some more changes to it, and then make a commit, something which defeats the purpose of accountability and credibility of having a VCS.

    2. Also, when we do a merge, we get to know of merge conflicts, meaning that we know where there were two conflicting instances of code, something which will be very helpful when debugging errors caused by the new code we just merged.

    3. Finally, another reason, which is although not very important but I am still mentioning it, is that while copy-pasting, the code may lose its formatting as well as the TABS and SPACES. This may be very damaging for a code written in python in fact.

    I will keep adding more points if they strike me :)

    Best.