brunch

You can make anything
by writing

C.S.Lewis

by Master Seo Nov 16. 2019

49. Git Pull Request 하기 (2/2)

오픈소스가 발전하는 이유

<1> 개요

<2> 작업 순서  



<1> 개요


1) gthub는 원본을 가져와 수정후 원본에 반영하여 개선하기도 한다.  오픈소스 발전에 유용한 도구임.

2) github로 대학교 수업을 하는 경우도 많다. 잘 알아 두자.





<2> 작업 순서  


1)  내 github사이트를 들어감

https://github.com/


원본 github 사이트 가서  Fork  ->  내 github로 가져옴.

내 github에  원본 데이터가 생김

Fork는 소스를 내 저장소로 가져온다.

Fork는  push가 가능하다.  

clone은 push는 안된다.



2) 내 PC에 Clone 하고,  수정해서 고침. 


로컬 pc에서  original github url을  upstream으로 해서 add 함

$ git remote add upstream  https://github.com/topasvga/original1.git

// git  remote  add  upstream  원본github_url (topasvga)

$ git remote -v
origin  https://github.com/topasvga1/taeho.git (fetch)

origin  https://github.com/topasvga1/taeho.git (push)

upstream        https://github.com/topasvga/original1.git (fetch)

upstream        https://github.com/topasvga/original1.git (push)



pull로 자료를 당김

$ git pull upstream


$ git pull upstream master

From https://github.com/ossdevforum/git-starter

* branch master -> FETCH_HEAD

Auto-merging README.md

CONFLICT (content): Merge conflict in README.md

Automatic merge failed; fix conflicts and then commit the result.



3) 원본 수정후 작성자에게 내가 수정했으니 반영해달라고 요청함.

원본 수정

github 원본 사이트에 요청함.

Pull 리퀘스트라고 한다.

내가 수정했다 반영해줘요


원본 작성자 답변1. 코드 리뷰 후 반영

원본 작성자 답변2. 충돌 났다. 다시 수정해 보내라.

원본 작성자 답변3. 원본자가 수정해줌. 



원본 작성자 답변2. 충돌 났다. 다시 수정해 보내라. 경우

상세

차이를 확인함.
git diff

차이를 수정함.
vi README.md
git add.

git commit -m "correct error"
git push origin master

$ git remote -v


$ git diff

diff --cc README.md
index 357 f12 c,4 f433 cc.. 0000000
--- a/README.md
+++ b/README.md
@@@ -101,4 -101,4 +101,5 @@@ Git과 Github을 능숙하게 다루 <EA>
+- [@topasvga](https://github.com/topasvga)

$ git add  .
user@user1 MINGW64 /c/git/git-starter (master|MERGING)

$ git commit -m "correct error"

[master d3 bdb6 c] correct error
user@user1 MINGW64 /c/git/git-starter (master)

$ git push origin master
Enumerating objects: 7, done.
Counting objects: 100% (7/7), done.
Delta compression using up to 4 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 323 bytes | 80.00 KiB/s, done.
Total 3 (delta 2), reused 0 (delta 0)
remote: Resolving deltas: 100% (2/2), completed with 2 local objects.
To https://github.com/topasvga/git-starter
ddcf6 c2.. d3 bdb6 c master -> master



몰아보기


https://brunch.co.kr/@topasvga/1821


감사합니다.

매거진의 이전글 48. GIT시작하기 (1/2)

작품 선택

키워드 선택 0 / 3 0

댓글여부

afliean
브런치는 최신 브라우저에 최적화 되어있습니다. IE chrome safari