What are conflicts ?

If you are not familiar with git conflicts, than you were very lucky using git or you didn't use it in such ways that you could fly instead of run.

Conflicts are such a wonderfull things, that sometimes you just can't help yourself by swearing at them (NOT people who did commits - obviously!).

But to be more professional - let's go back and explain - Conflicts... hmmm

Well you have your branch, let's say it's a master branch. You create new branch called "feature/New-Wonderful-Functionality".

Let's say you create 2 commits and one of them makes changes in README.md file in line 2. Then your manager/supervisor/whoever goes to your room/cubic/table and says has a quick hot-fix that needs urgent change in README.md file.

So you create a new branch based on master called "hotfix/Fixing-Bad-Name-in-README". You make changes in README.md file in 2 line. You commit your changes, push changes to remote branch and then make pull-request and merge them finally to master.

And then you forget about it. You go back to your new-wonderful-functionality branch. Make some additional commits (say - 2). You push your branch to remote branch.

Then you want to make pull-request to master. And That's when magic happens.

Your master branch has already changes in README.md at line 2 that are different then what you are having. Git don't know which change has priority and thus fires with "I"m not going to merge your code automatically - your changes conflicts with what you already have in your branch!" :)

So you have to work with this to fix issue. In most cases you will take only elements from your "hotfix" and leave your "new-wonderful-functionality" in next line.

Also check in Acknowledgements links that may or may not explain it better.

What type of conflicts I've encountered ?

Well let's see it in action, shall we ?

After making this recording I also needed to make a pushing with force:

git push origin +HEAD:branch

Notice the +HEAD - sign + makes forcing pushing to remote branch regretless of what was before on that particular branch.

Tools and applications used:

Acknowledgements of links I've found usefull while writing this article:

Other:

StackOverFlow:

Accomplished:

Merging all feature-branches at biking-endorphines

What about you? How do YOU manage your conflicts?

Give me your comment, how do you manage your conflicts? Do you use a GUI tools ? Do you make it via console/command line?

If you reached this point - I personally want to thank you for time you've spend!

Thanks ! Keep in touch :)



Comments

comments powered by Disqus