깃 사용 설명서 (1) - 기초

이윤우·2022년 7월 19일
0

Git

목록 보기
1/3
post-thumbnail

1. 원격 저장소와 로컬 저장소

Git은 원격 저장소와 로컬 저장소 두 종류의 저장소를 제공합니다.

  • 원격 저장소(Remote Repository): 파일이 원격 저장소 전용 서버에서 관리되며 여러 사람이 함께 공유하기 위한 저장소입니다.
  • 로컬 저장소(Local Repository): 내 PC에 파일이 저장되는 개인 전용 저장소입니다.

평소에는 내 PC의 로컬 저장소에서 작업하다가 작업한 내용을 공개하고 싶을 때에 원격 저장소에 업로드 합니다. 물론 원격 저장소에서 다른 사람이 작업한 파일을 로컬 저장소로 가져올 수도 있습니다.
출처: https://backlog.com/git-tutorial/kr/intro/intro1_2.html

2. 작업 내용 원격 저장소로 보내기

  • git add .
    작업 디렉토리(working directory) 상의 변경 내용을 스테이징 영역(staging area)에 추가하기 위해 사용하는 Git 명령어
  • git status
    작업 디렉토리와 스테이징 영역의 상태를 확인하기 위한 명령어
    git status의 결과를 보면 크게 3개의 영역으로 구분될 수 있습니다.
    • Changes to be committed: 이 영역은 스테이징 영역에 넘어가 있는 변경 내용을 보여줍니다.
    • Changes not staged for commit: 이 영역은 아직 워킹 디렉토리에 있는 변경 내용을 보여줍니다.
    • Untracked files: 이 영역도 아직 워킹 디렉토리에 있는 아직 한 번도 해당 Git 저장소가 관리한 적이 없는 새로운 파일을 보여줍니다.
      $ git status
      On branch search3
      Changes to be committed:
       (use "git reset HEAD <file>..." to unstage)
             modified:   src/components/Control/Control.jsx
             modified:   src/components/Input/Input.jsx
             modified:   src/components/List/ListItem.jsx
      Changes not staged for commit:
       (use "git add <file>..." to update what will be committed)
       (use "git checkout -- <file>..." to discard changes in working directory)
             modified:   src/components/Search/Search.jsx
             modified:   src/components/Search/Search.stories.jsx
      Untracked files:
       (use "git add <file>..." to include in what will be committed)
             src/components/Search/useSearch.js```
      
  • git commit -m "커밋 메세지"
    변화에 대한 기록을 남기는 명령어
  • git push origin

0개의 댓글