Wecode - Foundation 1 (부트캠프)/Git, Github

[Git/Github] 명령어 - 실습 이용

JBS 12 2023. 9. 4. 13:35

간단하게 이해하기 좋은 실습

 

[깃허브] branch 생성 후 github 업로드 성공!

포스팅 업로드를하다가, user- 회원가입 , 로그인 posting- 포스팅 이렇게 구분해서 코드를 미리 올려놓으면 좋겠다 싶어서, 내 개인 repository에 올리고 싶어서 다시한번 실패했던, 질문하려고 했던 g

pm-developer-justdoit.tistory.com


 

깃허브 branch 생성, remote 올리고, pull request, main branch pull 까지 : 한 사이클 정리

1) 로컬폴더 만들기 terminal에서 cd desktop > mkdir 폴더 만들고 (로컬 폴더) 깃허브 가서 new repository> create 만들고 terminal에서 git init 하고, git remote 혹은 git remote-v 하면 아무것도 안 나오는 게 정상 이

pm-developer-justdoit.tistory.com


순서대로 아님 

1. Linux 세션 때 만든 wecode 폴더로 이동

  • cd Desktop/wecode

2. wecode 폴더 안에 git_practice 폴더 생성

  • mkdir git_practice

3. Git 시작 : git init

  • git_practice 폴더 진입 후 (cd git_practice)
  • .git 폴더 확인 (ls -al)

4. 본인영문이름.md 파일 생성

  • touch seungyunlee.md

5. 해당 파일에서 본인 이름 작성 후 저장

  • vi seungyunlee.md
  • insert 모드 전환 후 내용 작성 및 저장
  • Optional) git 상태 확인 : git status

7. Staging(중간 저장) : git add .

  • Optional) git 상태 확인 : git status

8. Commit : git commit -m "메세지"

  • Optional) git 상태 확인 : git status

9. Commit history 확인 : git log

10. Github repo 생성

  • github 사이트 → New repository

11. git_practice 폴더와 github repository 연동

  : `git remote add origin repository주소`

12.git push origin [branch이름]

13. 깃허브에서 git clone [해당 branch url] 하면 폴더가 로컬에 다운 받아짐

프로젝트할떄, 각 팀원들이 다른 팀원이 만든 코드를 main 저장소에 올린 거를

clone으로 각자 로컬에 다운 받는다

 

터미널에서 git clone  [해당 branch url 복붙] 

하면 폴더가 로컬에 다운 받아짐.   ---> branch를 별개로 생성해야 함