30

Possible Duplicate:
How git works when two peers push changes to same remote simultaneously

I'm kinda new to git and me and a friend want to do some collaborative developing with git. I got the whole pull and push system down somewhat, now I have a question.

I want to work on file test.php and I pull for new changes. Nothing. I edit it and want to push it, but in this time my friend edited and pushed it. What happens now? How are these conflicts solved?

Thank you!

Community
  • 1
  • 1
mishmash
  • 4,422
  • 3
  • 34
  • 56
  • It's been already discussed on this site: [How Git works when two peers push changes to same remote simultaneously][1] [1]: http://stackoverflow.com/questions/4643998/how-git-works-when-two-peers-push-changes-to-same-remote-simultaneously – bchetty Dec 14 '11 at 17:28
  • 1
    I'm not a `git` guy, I'm an `svn` guy, so I can't answer the question. I should point out, however, that the entire point of these version control systems is to handle the exact case you're describing. It's their *fundamental* purpose. Expect this to happen very often. – corsiKa Dec 14 '11 at 17:29
  • @bchetty: Nice find! Also, the link markup is different in comments: `[link text](url)`. You can click "help" to remind yourself. – Cascabel Dec 14 '11 at 21:09

1 Answers1

41

the procedure should be the below:

  • pull the file
  • edit it
  • commit it(it commits to your local repository)
  • pull it again (if there are any conflict you will Be notified) in that case you can solve it executing the below command(GitBash on your repository working folder):

    git mergetool

it will run the merging tool you got configured in your .gitconfig file

after that you can push your changes

Massimiliano Peluso
  • 26,379
  • 6
  • 61
  • 70