브랜치 조회, 로컬에것만 조회됨
git branch
리모트에 브랜치 조회
git branch -r
모두 조회하고싶은 경우
git branch -a
생성된 시점의 커밋된 내용들을 모두 갖고 있음, b까지 커밋된 상태에서 브랜치를 생성하면 b까지는 내용이 동일하고 이후로는 갈라질 수 있음
git branch branch01
브랜치01로 이동
git checkout branch01
생성과 이동을 같이, 동일한 브랜치가 없을 경우 새로 만들고 이동
git checkout -b branch01
로컬에서 만들어도 리모트에서는 보이지 않음(push하지 않은 상태에서)
branch01을 리모트에 푸쉬
git push origin branch01
로컬에서 삭제, 현재 머물러있는 브랜치는 삭제 못함
git branch -d 브랜치이름
리모트에 브랜치 삭제
git push origin --delete 브랜치이름
--vscode, git
git에서도 code .으로 해당 폴더에서 vscode실행 가능
remote repository 생성
log_repository
git clone https://DaKu00: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@github.com/DaKu00/log_project.git
cat > hello.py
branch 별 변경이력을 볼 수 있음
맨 아래가 시작
commit a8ed~~~가 있는데 커밋 뒷부분은 고유번화와 같은 것으로 정확한 커밋 지점을 찾는용도
--wait 옵션은 command line으로 vscode를 실행시켰을 경우, vscode 인스턴스를 닫을 때까지 command를 대기
git config --global core.editor editorname --wait
git config --global core.editor code --wait
git diff tool
git configuration 파일 열기
git config --global -e
에디터 실행 후 아래 코드 작성
[diff]
tool = vscode
[difftool "vscode"]
cmd = "code --wait --diff $LOCAL $ REMOTE"
로컬브랜치간 비교 차이를 보여줌
git diff branch01 branch02
커밋간 비교, 커밋해쉬는 git log로 알수 있음, 고유번호같던 그것
git diff commithash commithash
마지막 커밋과 이전 커밋 비교
git diff HEAD HEAD^
마지막 커밋과 현재 와 비교
git diff HEAD
로컬과 리모트간 비교
git diff main origin/main