When faced with a merge conflict, the first step is to understand what happened. Git will then mark the file as having a conflict – which you’ll have to solve before you can continue your work. But if two people changed the same lines in that same file, or if one person decided to delete it while the other person decided to modify it, Git simply cannot know what is correct. Even in this case, Git will most likely be able to figure it out on its own. Most commonly, this is when there are changes to the same file on both branches. However, there’s a handful of situations where you might have to step in and tell Git what to do. Have a look at this introduction to branching if you’re new to the concept in general.Ī great thing about having Git as your version control system is that it makes merging extremely easy: in most cases, Git will figure out how to integrate new changes. You’re taking changes from another context (that’s what a branch effectively is: a context) and combine them with your current working files. In Git, “merging” is the act of integrating another branch into your current working branch. This is because, in Git, conflicts can only occur on a your local machine – and not on the server. It will not bring your complete team to a halt or cripple your central repository. As a consequence, Git is able to take care of most things during a merge – leaving you with comparatively simple scenarios to solve.Īlso, a conflict will only ever handicap yourself. ![]() One reason for this is that Git, simply stated, works completely different in this regard than Subversion. Subversion) you might be traumatized: conflicts in Subversion have the (rightful) reputation of being incredibly complex and nasty. If you’re coming from another version control system (e.g. ![]() You’re always able to undo and start fresh. The first thing that you should keep in mind is that you can always undo a merge and go back to the state before the conflict occurred. Once you understand how merge conflicts work and how to deal with them, I’m sure you’ll be able to cross them off this list. ![]() When using Git for version control, there is nothing to fear. When I was preparing my book, I wasn’t surprised that a lot of designers and developers would add merge conflicts to this list without hesitation. Everybody has a list of things they don’t like: an appointment at the dentist, a traffic jam, or a canceled flight.
0 Comments
Leave a Reply. |