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!
So you can also have collaborators working on different lines within the same file and GitHub will be able to weave those changes into each other – that's it's job! It's when you have collaborators working on the same lines within the same file that you can have merge conflicts.
From what I understand, the benefit of Git is that two+ people can work on the same file that they pulled and make changes to it locally.
Multiple people can work on the same branch at the same time. When you pull (or have the other person push) their changes to you git will merge the changes together resulting in a branch with both of your changes.
If server detects a conflict when someone pushes data (and if two users are doing this "simultaneously" one of the pushes will be conflicting, because it will be applied only after the other one completes), the server will reject it, and the unlucky user shall then resolve conflicts and try to push again.
the procedure should be the below:
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With