Skip to content
Joona Yoon edited this page Jan 11, 2018 · 7 revisions

협업을 위한 Git 튜토리얼

초심자를 위한 Github 협업 튜토리얼 (with 토끼와 거북이)

Fork한 Repository 업데이트

원본 repository를 remote repository로 추가한다.

$ git remote add upstream https://github.com/alps-jbnu/litmus-site.git

upstream repository가 제대로 되었는지 확인한다.

$ git remote -v origin  
https://github.com/YOUR_USERNAME/litmus-site.git (fetch)  
https://github.com/YOUR_USERNAME/litmus-site.git (push)    
http://github.com/alps-jbnu/litmus-site.git (fecth)    
http://github.com/alps-jbnu/litmus-site.git (push)  

Git의 fetch 명령을 통해 upstream repository의 내용을 불러온다

$ git fetch upstream  
remote: Counting objects: 75, done.  
remote: Compressing objects: 100% (53/53), done.  
remote: Total 62 (delta 27), reused 44 (delta 9)  
Unpacking objects: 100% (62/62), done.  
From https://github.com/alps-jbnu/litmus-site  
* [new branch]      master     -> upstream/master  

upstream repository 의 master branch (혹은 원하는 branch) 로부터 나의 local master branch 로 merge 한다.

$ git checkout master  
Switched to branch 'master'  
 
$ git merge upstream/master  
Updating a422352..5fdff0f  
Fast-forward  
  README                    |    9 -------  
  README.md                 |    7 ++++++  
  2 files changed, 7 insertions(+), 9 deletions(-)  
  delete mode 100644 README  
  create mode 100644 README.md  

마지막으로 remote repository에도 push 해주면 된다

$ git push origin master

Pull Request를 checkout

github 코드 리뷰를 위해 pull request를 checkout 하는 방법