How to use git for multiple developers

2020-07-24 04:30发布

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?

2条回答
虎瘦雄心在
2楼-- · 2020-07-24 05:08

Yes. It's going to be

 git clone $giturl
 git add .
 git commit
 git push

for him.

查看更多
放荡不羁爱自由
3楼-- · 2020-07-24 05:16

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
查看更多
登录 后发表回答