![]() There are plenty of tools out there, that will help you resolve these conflicts visually and that will work well together with Sourcetree. But sometimes there are pretty complex conflicts happening to a file and the conflict markup becomes pretty messy. The example above is pretty simple and you might be able to solve the conflict using a text editor. When a conflict happens, your job is to clean it up. So = separates the changes that will cause the conflict. Lines after the = are the changes coming from the other branch. Text after the first marker shows content of your current working file. Git will wrap conflicted areas with a > marker at the end. Let's take a closer look on how a conflict will reflect in markup of your file. Sourcetree will help you to identify conflicted files. Did a merge conflict happen because of a deleted or modified file or did you both add a file with the same name? When a merge conflict happens the first thing you probably should do is to stay cool an figure out what just happend and why. But if two persons change the same lines in the same file on different branches or if one person decides to deletes parts of a file while the other started making changes on it at the same time Git won't know how to solve this situations alone and therefore it will mark this file as conflicted in order to let you know that it is up to you to solve them. Even then Git will be able to figure out how to integrate changes. These situations will most likely happen when two persons worked on the same file on different branches. But there are some cases where you need to tell Git what to do. The good thing about Git is, that it is pretty smart and figures out how to integrate new changes by itself without your help. Doing this you grab the code of another branch an combine it with your current working files. ![]() ![]() Merging is the process when integrating the codebase of one branch into the one you are curently working with. Git also takes care of most things during merging and even when it comes to conflicts in worst case you'll just handicap yourself and it won't bring your complete team to halt. Git enables you to revert merges, undo things and start from scratch. One thing you should always remember is that you cannot break things because of merging. But still, for a lot of developers there is still one big fear left – Merge-Conflicts You cannot break things But let me tell you that there is almost no way to mess up a project when you follow the suggested Workflow when starting to collaborate on code. Everybody's greatest fear when working with Git or any other Version Control System is to mess it up. ![]()
0 Comments
Leave a Reply. |