tech.junha.kr

노트/Git

What is Git?

작성

1. 저장방식

  • Git은 다른 VCS과 달리, 데이터를 저장하는 방식이 다르다.
  • Most other systems (CVS, Subversion, Perforce, Bazaar)

다른 VCS의 저장 방식

  1. Copied from the previous generation
  2. Storing data as changes to a base version of each file

  • Store information as a list of file-based changes.
  • Store as a set of files and the changes made to each file over time
  • This is commonly described as delta-based version control

GIT의 저장방식

  1. Snapshots, Not Differences
  2. Storing data as snapshots of the project over time

Git doesn’t think of or store its data this way. Instead, Git thinks of its data more like a series of snapshots of a miniature filesystem. With Git, every time you commit, or save the state of your project, Git basically takes a picture of what all your files look like at that moment and stores a reference to that snapshot.

  • To be efficient, if files have not changed, Git doesn’t store the file again, just a link to the previous identical file it has already stored. Git thinks about its data more like a stream of snapshots.

  • a mini filesystem with some incredibly powerful tools built on top of it, rather than simply a VCS.

2. 로컬에서 실행

  • 커밋을 기반으로 버전을 관리하기 때문에 로컬에서 손쉽게 관리할 수 있다.

3. 무결성

  • 데이터를 저장하기 전에 항상 체크섬을 구하고, 그 체크섬으로 데이터를 관리한다.
  • SHA-1 해시를 이용해 체크섬을 만든다. (40자 길이, 16진수 문자열)
  • Git은 모든 것을 해시로 구별하기 때문에 파일을 이름으로 저장하지 않고 해당 파일의 해시로 저장한다.
  • 한 번 커밋하고 나면 데이터를 잃어버리기 어렵다.