How to use git for multiple developers

梦想的初衷 提交于 2019-12-21 21:22:23

问题


Here is very simple question for experienced Git user. I've created repository on git hosting and set up mine pc:

git init
git remote add origin git@*.sourcerepo.com:*/ *.git

Then, after some changes I do:

git add .
git commit
git push

All these actions are done on first developer pc.

Now the question: How does second developer access and take changes to repo? First of all he has to clone repo?


回答1:


Yes, you would use clone. You also should be sure to set the sharedrepository config option:

git config core.sharedRepository "true"

You should also be aware, with multiple commiters that the fetch option would let you preview the changes in the main repository, and how they would apply to you:

git fetch
git diff origin

or you may want to simply see a list of files and diff each one seperately:

git diff --name-status origin



回答2:


Yes. It's going to be

 git clone $giturl
 git add .
 git commit
 git push

for him.



来源:https://stackoverflow.com/questions/1492398/how-to-use-git-for-multiple-developers

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!