Week5-2_Github_Collaborator
1. 내 Repository에 Collaborator 추가하기
- Repository - Settings - Manage access - Invite a collaborator
- 초대 받은 사람이 수락하면 Collaborator가 된다
- 아래부터는 ‘초대받은 사람’ 기준으로 설명한다
2. Remote Repository로부터 Clone하기
- 편의상, 이 노트에서는 ’초대받은 사람’의 Local 드라이브 대신, 구글드라이브에 임시 폴더를 만들어 진행한다
from google.colab import drive
drive.mount('/content/drive')
Mounted at /content/drive
cd /content/drive/MyDrive/
/content/drive/MyDrive
cd temp
/content/drive/MyDrive/temp
!git clone "https://github.com/chorok-daddy/repository-basic.git"
Cloning into 'repository-basic'...
remote: Enumerating objects: 15, done.[K
remote: Counting objects: 100% (15/15), done.[K
remote: Compressing objects: 100% (10/10), done.[K
remote: Total 15 (delta 3), reused 2 (delta 0), pack-reused 0[K
Unpacking objects: 100% (15/15), done.
cd repository-basic/
/content/drive/My Drive/temp/repository-basic
!git config --local user.email "chorok.crew@gmail.com"
!git config --local user.name "chorok-crew"
!git add .
!git commit -m "Edit Readme.md by chorok.crew"
[main 4ada371] Edit Readme.md by chorok.crew
1 file changed, 3 insertions(+), 1 deletion(-)
5. Remote Repository로 Push
- Collaborator는 Repository 주인과 같은 권한을 갖는다 = main에 push가 가능하다
!git remote add repo-basic https://collaborator_username:token@github.com/chorok-daddy/repository-basic.git
!git push -u repo-basic main
Counting objects: 3, done.
Delta compression using up to 2 threads.
Compressing objects: 50% (1/2)
Compressing objects: 100% (2/2)
Compressing objects: 100% (2/2), done.
Writing objects: 33% (1/3)
Writing objects: 66% (2/3)
Writing objects: 100% (3/3)
Writing objects: 100% (3/3), 359 bytes | 119.00 KiB/s, done.
Total 3 (delta 1), reused 0 (delta 0)
remote: Resolving deltas: 100% (1/1), completed with 1 local object.[K
To https://github.com/chorok-daddy/repository-basic.git
0ecdaa4..4ada371 main -> main
Branch 'main' set up to track remote branch 'main' from 'repo-basic'.
6. Branch 만들기
- !git checkout [브랜치명] : 해당 브랜치로 시점을 옮긴다
- -b 옵션 : 브랜치를 새로 만든 후 그 브랜치로 이동
!git checkout -b branch01
Switched to a new branch 'branch01'
!git status
On branch branch01
nothing to commit, working tree clean
!git branch
* [32mbranch01[m
main[m
7. Branch에서 Readme.md 파일 수정하기
8. 수정된 사항 commit 하고, remote에 push하기
!git add .
!git commit -m "Edit Readme.md in Branch01"
[branch01 27e8e07] Edit Readme.md in Branch01
1 file changed, 3 insertions(+)
!git push repo-basic branch01
Counting objects: 3, done.
Delta compression using up to 2 threads.
Compressing objects: 50% (1/2)
Compressing objects: 100% (2/2)
Compressing objects: 100% (2/2), done.
Writing objects: 33% (1/3)
Writing objects: 66% (2/3)
Writing objects: 100% (3/3)
Writing objects: 100% (3/3), 335 bytes | 167.00 KiB/s, done.
Total 3 (delta 1), reused 0 (delta 0)
remote: Resolving deltas: 0% (0/1)[K
remote: Resolving deltas: 100% (1/1)[K
remote: Resolving deltas: 100% (1/1), completed with 1 local object.[K
remote:
remote: Create a pull request for 'branch01' on GitHub by visiting:[K
remote: https://github.com/chorok-daddy/repository-basic/pull/new/branch01[K
remote:
To https://github.com/chorok-daddy/repository-basic.git
* [new branch] branch01 -> branch01
9. Merge 하기 (Pull Request)