[S01E01] Understanding Their Meme: The Scariest Things on Earth
Hello everyone, welcome to my all-new series called "Understanding Their Meme". This series is based on explaining programming/ developer memes to beginners or someone who is not introduced to development yet.
Let's start this series with the first meme: *drums rolling*
Tada!
In this meme, they have conveyed "merge conflict" to be the "scariest things" on Earth. Now, what is this "merge conflict". If you have tried your hands with Git or GitHub or any other Version Control System, you would know what this is but sometimes its possible you might have not experienced this yet.
Let's first define it and then I will show you an example to better understand it.
Definition: A merge conflict is an event that occurs when Git is unable to automatically resolve difference or changes in code or files between two commits. Git can merge the changes automatically only if the commits are on different lines or branches.
Now, lets understand this by an example:
Let's imagine, there are two developers and both of them pull ( download ) the same file or code from the same remote repository. Now they might be working on different system but they are making changes to the same file under same remote repository. Now when Developer Nikita tried to push back the file from her local repository to remote repository, she is able to do so but when Developer Herika tried to push back different version of that file, she is unable to do so. That is because her version of the file before making any changes is different from what's there in the remote repository now which contains changes made by Nikita. Confusing?
Lets simplify this process (both are working on same branch):
1. Nikita and Herika download the file, Hello.js which contains just one line: console.log("Hello");
2. Nikita quickly make changes to Hello.js by adding another line: console.log("Nikita");
3. Nikita pushes changes to remote repository, which changes the contents of Hello.js from one line of code to two lines of code.
4. On other hand, Herika is making changes to same file and adds her line:
5. Now when Herika tries to push this file to remote repository, Git stops the process as it expects Nikita's version but instead it is getting the original Hello.js for changes.
And this is called as MERGE CONFLICT.
To avoid such situations, developers work in separate isolated branches.
Coming back to the meme, its gets scary when you work in larger teams or big projects.
Comments
Post a Comment