Git

GitHub 기초 / 개발 방법론

KimYHG 2024. 10. 20. 20:37

git은 버전 관리 프로그램  /  .git폴더가 local repository

gitHub는 remote repository (백업용)

 

<<프로젝트를 GitHub에서 관리하기>>

1. 기본 브랜치명 변경 - gitHub에서는 기본 브랜치를 main으로 권장

 git branch -M main

2. local repository에서 remote repository로 올리기

 git push -u [gitHub원격저장소 주소] [로컬branch명]
 
 // ex) git push -u https://github.com/../..git  main

3. 원격 저장소 주소를 변수로 만들기

 git remote add [변수명] [gitHub저장소 주소]
 //ex) git remote add origin https://github.com/../..git
 
 그 이후로 push할 경우
 git push -u origin main
 
 * 저장된 변수명을 보고 싶으면
 git remote -v

4. 원격 저장소에 있는 프로젝트를 내려받기

 git clone [gitHub저장소 주소]

5. 원격 저장소에 있는 프로젝트를 로컬 저장소에 업데이트하기

 git pull [원격저장소 주소]
 git pull [원격저장소 주소] [브랜치명] 	(원격저장소 주소 브랜치명을 가져오기)
 
 * git pull = git fetch + git merge

* 협업시 git pull -> git push 순으로 진행하기

6. Pull Request

 

7. 브랜치 삭제

git push origin -delete [브랜치명] # 원격 브랜치 삭제

8. 원격 레파지토리 변경 내용 확인(병합X)

git fetch
#변경 사항이 있다면
git pull origin develop # develop 브랜치가 변경되었다면 가져와서 동기화하고 conflict발생시 해결

 

 

https://docs.github.com/ko

 

GitHub.com 도움말 문서

GitHub Docs GitHub 여정 중 어디에 있든 도움이 됩니다.

docs.github.com

 


GitHub 개발운영 방법론

 - GitFlow / Github Flow / Trunk-based / Gitlab Flow 등

 - 각 전략은 상황에 따라 유연하게 사

1.GitFlow 개발전략

출처 : https://codingapple.com/course-status/, (2024.10.20)
출처 : https://codingapple.com/course-status/, (2024.10.20)

2.trunk-based 개발전략

 - Github Flow와도 유사

출처 : https://codingapple.com/course-status/, (2024.10.20)
출처 : https://codingapple.com/course-status/, (2024.10.20)