两个人在git中同时处理一个文件 [英] Two people working on a file at the same time in git

查看:790
本文介绍了两个人在git中同时处理一个文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能存在重复:


我对git和我有点新鲜,朋友想用git做一些协作开发。我得到了整个推拉系统,现在我有一个问题。



我想处理文件 test.php 和I拉动新的变化。没有。我编辑它并且想要推它,但在这个时候我的朋友编辑并且推挤它。现在会发生什么?这些冲突是如何解决的?



谢谢!

解决方案

程序应该如下:


  • 拉取文件

  • 编辑它

  • 提交它(它会提交给本地存储库)
  • 再次提取它(如果存在任何冲突,您将收到通知),在这种情况下,您可以解决它执行下面的命令(GitBash在你的仓库工作文件夹中):
    $ b $ git mergetool




它将运行您在.gitconfig文件中配置的合并工具



之后,您可以推送您的更改


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!

解决方案

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

这篇关于两个人在git中同时处理一个文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆