Git 활용 2
git diff
- commit 이전과 현재의 차이를 확인
- commit id 를 통해 특정 commit과 비교
git diff id1 id2 : 두 commit 비고
git diff 보다 시각적으로 보기 쉽게 표현
- 사용법은 동일
VSCode 부가 기능
- git 사용을 위한 다양한 부가기능 설치 가능
git branch
git branch 브랜치명 : 브랜치 생성
git switch 브랜치명 : 브랜치 변경
git merge 브랜치명 : 주가 될 브랜치로 이동후 브랜치명 병합
git log --graph --oneline --all : commit 내역 그래프로 호출
git branch -d 브랜치이름 : 삭제
git restore
git restore 파일명 : 최근 commit 상태로 복원
git restore --source id 파일명 : 특정 commit 상태로 복원
git restore --파일명 : 특정 파일 staging 취소
git revert
git revert id : 해당 commit에서 작성한 내용 취소(파일 생성, 삭제 등 포함)
git revert HEAD : 최근 1개 취소
git reset
- 특정 시점으로 초기화
git reset --hard id : 해당 시점 이후 내용 삭제
git reset --soft id : 해당 시점 이후 내용 staging
git reset --mixed id : 해당 시점 이후 내용 staging 이전 상태