처음부터는 init, 어딘가에서 가져오면 clone
디스크에 Git repo 띄우는 두 가지 방법: history 를 같이 들고 오거나 (git clone), 새 history 를 시작하거나 (git init). 표면적으론 둘 다 .git/ 폴더를 만들지만 결과가 달라. 어느 쪽 원하는지 아는 게 daily loop 의 출발점이야.
git init 은 현재 디렉토리에 빈 repo 를 만들어. commit 없고, 첫 commit 만들기 전엔 branch 도 없고, remote 도 없어. default branch 이름은 init.defaultBranch 따라가 (global 에 main 으로 박아둬, 옛 default master 는 미관리 Linux 짐이야). git init 다음엔 보통 시작용 .gitignore 쓰고, git add . 하고, 첫 commit 으로 프로젝트 history 를 실제로 시작해.
git clone 은 기존 repo 를 받아와. 기본으로 모든 branch 를 remote-tracking ref 로 복사하고 (origin/main, origin/feature 등), default branch checkout, clone URL 가리키는 origin 이라는 remote 까지 세팅해. SSH URL (git@github.com:user/repo.git) 은 매일 password 프롬프트 안 뜨게 해주고, HTTPS URL (https://github.com/user/repo.git) 은 막힌 회사 네트워크 포함 어디서나 되지만 token 이나 credential helper 가 필요해.
큰 repo 는 clone trick 두 가지 알면 좋아. --depth 1 은 shallow clone — 최신 commit 만, history 없이. 빠르지만 blame, bisect 가 의미 없어. --filter=blob:none 은 partial clone — commit graph + tree 구조만 즉시 받고 blob 은 checkout 할 때 lazy fetch. 대부분 workflow 에 shallow 보다 modern + 빠름. Git 2.20+ 부터 가능.