Branch

예: 파일을 생성하고 master & testing branch의 동작을 정리

$ git add README test.rb LICENSE
$ git commit -m 'The initial commit of my project'

위 코드가 실행되면 아래와 같이 세 개의 git object가 생성된다.

commit이 일어날 때 git 저장소에 위와 같은 파일이 저장된다.

commit이 일어날 때 git 저장소에 위와 같은 파일이 저장된다.

이전 commit에 대한 기록이 저장됨

이전 commit에 대한 기록이 저장됨

branch는 commit의 시점(snapshot)을 가리킨다.

branch는 commit의 시점(snapshot)을 가리킨다.

# HEAD:master에서 실행
$ git branch testing

master가 기리키고 있는 시점을 testing branch가 가리킴

master가 기리키고 있는 시점을 testing branch가 가리킴

# HEAD가 어딜 가리키는지 확인(현재 master)
$ git config --global alias.decorate 'log --oneline --decorate'
# alias 설정
$ git decorate

HEAD → master

HEAD → master

checkout testing: HEAD → testing

checkout testing: HEAD → testing

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/0fcb40d1-4d30-4ea7-a907-579993c7302f/Untitled.png

modified: test.rb: HEAD→testing

modified: test.rb: HEAD→testing