-1

I have a a module that i am working on and someone else is working on another module. So in whatever means, there shouldnt be any conflicts between our work.

Is there a way i am missing to overcome this issue? as if i am working on an improvement and someone all of sudden makes a change, is it possible to pull that persons change without impacting on my system?

(new to git)

jagmitg
  • 4,236
  • 7
  • 25
  • 59
  • You should be able to `git pull` without conflicts if there exists no overlap in your and your colleague's work (assuming that you are not yet using branches). – Whymarrh Dec 02 '15 at 01:29
  • @Whymarrh Everytime i try to, it says i that i should commit first. No we are not using branches, we all work on one branch (dev) and push to the code from our local. – jagmitg Dec 02 '15 at 01:31
  • 1
    Commit first, then. Git's not lying to you here. Your changes are only going to be stored if you commit them, after all. – Makoto Dec 02 '15 at 01:31
  • @Makoto, in the scenario where there is a merge conflict, what happens? – jagmitg Dec 02 '15 at 01:32
  • @SophieRhodes this answer might be useful: http://stackoverflow.com/a/30209750/1267663. If there are merge conflicts, you will be asked to resolve them manually. – Whymarrh Dec 02 '15 at 01:33

1 Answers1

2

This depends on your workflow and also depends on where you and your colleague is working.

First and foremost, if you each are working on your own individual branches, there won't be any conflicts to address until you both merge your branches into master, or some other agreed-upon integration branch.

If you're working in the same branch, then the risk of stepping on each other's toes increases, but can be easily mitigated. Git does a decent job already of avoiding silly collisions, but it will happily inform you when there is the potential of a conflict and it will hand back control to you.

If you run into a merge conflict, you and your colleague need to put your heads together to see what caused it, why, and how to mitigate it. Having tests in your code goes a long way to ensure that behavior isn't missing when the conflict is resolved. This is a personnel thing more than a Git thing, as Git can only do so much in that regard.

Makoto
  • 104,088
  • 27
  • 192
  • 230