Branch 별 변경이력을 볼 수 있게 하는 것
아래의 커맨드를 터미널에 입력하면 로그가 프린트 됨
git log
Git log나 graph를 좀 더 편하게 확인하기 위해, 기본 에디터를 VSCode로 바꾸려고 함
기본 Git Editor 확인
git config --global core.editor
--wait 옵션은 command line으로 vscode를 실행시켰을 경우, vscode 인스턴스를 닫을 때 까지 command를 대기시킴 (선택 옵션)
git config --global core.editor <editorname> --wait
Git configuration file을 수정함으로써 git editor 변경하기
git config --global -e # 에디터가 열리면 config 파일에 아래의 코드 추가 [diff] tool = vscode [difftool "vscode"] cmd = "code --wait --diff $LOCAL $REMOTE" # 저장 후 닫기
기본 에디터가 vscode로 변경되면, local branch 별 또는 commit 별, local & remote repository 사이 비교가 가능해짐
# branch 간 비교 git diff <branch1> <branch2> git difftool <branch1> <branch2> # vim 말고 내가 설정한 editor에서 확인하는 기능
commit 해쉬로 비교하기 (commit 별 비교)
# git log에 들어가서 commit 옆의 복잡한 코드가 해쉬임 (전체 말고 앞의 7자리 까지 복사해도 인식 가능) # 비교하고 싶은 commit 두 개의 해쉬를 복사한 후, # fc65787bc4b95d18d5e062ea35ae4a1bd2e28503 create # 577c18f2f2a298668ac549f8b81bdfcfaa3381cf modify 1 git difftool fc65787bc4b95d18d5e062ea35ae4a1bd2e28503 577c18f2f2a298668ac549f8b81bdfcfaa3381cf
현재 작업 디렉토리와 최신 commit(HEAD) 간의 변경 내용 비교
git difftool HEAD