Reputation: 986
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?
Upvotes: 3
Views: 2194
Reputation: 1328562
Beware of option when multiple developers are applying patches:
With Git 2.30 (Q1 2021), "git apply
" adjusted the permission bits of working-tree files and directories according core.sharedRepository
setting by mistake and
for a long time, which has been corrected.
apply
: don't use core.sharedRepository to create working tree files
core.sharedRepository
defines which permissions Git should set when creating files in $GIT_DIR, so that the repository may be shared with other users.But (in its current form) the setting shouldn't affect how files are created in the working tree.
This is not respected by
apply
andam
(which usesapply
), when creating leading directories:$ cat d.patch diff --git a/d/f b/d/f new file mode 100644 index 0000000..e69de29
Apply without the setting:
$ umask 0077 $ git apply d.patch $ ls -ld d drwx------
Apply with the setting:
$ umask 0077 $ git -c core.sharedRepository=0770 apply d.patch $ ls -ld d drwxrws---
Only the leading directories are affected.
That's because they are created withsafe_create_leading_directories()
, which callsadjust_shared_perm()
to set the directories' permissions based oncore.sharedRepository
.To fix that, let's introduce a variant of this function that ignores the setting, and use it in
apply
.
Also add a regression test and a note in the function documentation about the use of each variant according to the destination (working tree or git dir).
Upvotes: 0
Reputation: 1322
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
Upvotes: 6
Reputation: 47889
Yes. It's going to be
git clone $giturl
git add .
git commit
git push
for him.
Upvotes: 4