2

What are good practices to avoid getting a merge conflict?

Comments
  • 0
    .

    Among others or just your branch?
  • 6
    Proper communication with the team and always do a git fetch then create new temporary branch then do the git pull there. Also check commits and changes in the online github or Bitbucket
  • 2
    @devTea Just my branch.
  • 0
    @oreru so we are doing a small application for a school's project. I was the only one who was working on it till 2 days ago, my friend starts working on it and we usually code at the same time and on the same file so we keep getting conflicts. I want to know if theres anyway to avoid that as much as possible.
  • 1
    1. Pull
    2. Push
  • 1
    @FahadAlt

    Pull again
    Push again

    😉
  • 1
    Don’t edit the same document at the same line (and the line above and below).
  • 0
    Don't use version control. |m|
  • 1
    Short answer: Open-close principle.

    Code should be design so changes to existing code made by adding/removing classes as a whole, instead of modifying existing one.

    Example: you have a service that writes messages into a queue. Now boss wants to change the code to write both to the queue and also a file.

    Bad code: you go and edit the service to write both to the queue and the file.

    Good code: ADD a new class (a decorator) that wraps existing service, with the ability to write to the file.

    Anyways,

    You wont have merge conflicts if you always ADD instead of MODIFY the code.
  • 0
    Don’t merge
Add Comment