Two people working on a file at the same time in g

2020-05-17 05:13发布

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!

标签: git github
1条回答
够拽才男人
2楼-- · 2020-05-17 05:48

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

查看更多
登录 后发表回答