InKyungWoo - Overview

git과 github의 차이

- repository : 저장소
- local : 자신의 컴퓨터
- origin : 원격 저장소(깃허브 페이지)

Untitled

<aside> 🖥️ Repository 복제 방법 2가지

fork : 다른 사람의 respository → 내 github repsoitory로 그대로 복제

clone : : 다른 사람의 respository ⇒ local로 복제해서 새로운 저장소 만들기

</aside>

git 설정하기

<aside> ✔️ Github 설정

  1. homebrew, git 설치

  2. git config 설정 git config —global [user.name](<http://user.name>) “이름” git config —global [user.email](<http://user.email>) “이메일” git config —list

  3. git clone “레포 주소 링크”

  4. 새로운 레포 생성 public/private, gitignore 설정 가능

  5. git status

  6. git add 파일명 : 깃에 파일 추가

  7. git commit vi 창 (command mode) - commit 메세지 작성 후 커밋 가능 i - insert esc :wq enter

    > git commit -m "커밋메시지"
    # vim 편집기화면을 건너뛰고 한줄짜리 메시지와 함께 곧바로 커밋할 수 있음
    
    > git commit --ammend
    # 방금 전 올린 commit message를 수정할 수 있음
    
  8. git push : 서버에 넣음

  9. git pull : 서버의 변경사항을 내 pc에 적용

  10. 다 하고 status 보면 nothing to commit, working tree clean

  11. 파일 내용 변경 있으면 다시 git add 하고 푸시 </aside>

<aside> ❗ repo 꼬였을 때

git remote add origin <https://github.com/hufs-mobile/Props_201904385.git>
# 에러나면 git remote remove origin 하고 다시
git branch -M main
git push -u origin main

✅  에러나서 git add 하고 커밋 하고 다시 푸시!

git add .
git commit -m "커밋 메세지 작성"
git push -u origin main

</aside>

1. git clone 하기: https://github.com/hufslion11th/github_session

2. branch 만들기

브랜치를 통해서 하나의 프로젝트를 여러 갈래로 나누어서 관리 및 개발 가능

브랜치 생성 및 checkout