내가 이해한 git

  • 스냅샷 : 특정 시점에 생성된 백업 복사본
  • commit : 스냅샷을 만들어 주는 작업
  • github : git repository를 관리할 수 있는 클라우드 기반 서비스

Local repository의 영역

  • Untracked area : git이 관리하고 있지 않은 영역
  • Tracked area
    • Unmodified : 기존에 commit했던 파일을 수정하지 않은 상태
    • Modified : 기존에 commit했던 파일을 수정한 상태
    • Staged : commit이 가능한 상태.

git restore

  • git restore <file>
    • staging area에 있지 않은 파일에서 작업 디렉토리의 변경을 무시
    • working directory에서 변경한 내용도 되돌려진다.

Javascript

console.log("first");
console.log("second"); //변경한 코드
//git restore <파일명> 후의 코드
console.log("first");
  • git restore --staged <file>
    • staging area에 있는 파일을 제외시킨다.
    • working directory에서 변경한 내용은 그대로이다.

Javascript

console.log("first");
console.log("second"); //변경한 코드
//git restore --staged <파일명> 후의 코드
console.log("first");
console.log("second"); //변경한 코드

0개의 댓글

Powered by GraphCDN, the GraphQL CDN