다른 작업과 차이를 비교해보자!
Git Editor 설정
git config --global core.editor <editorname> --wait
# ex) git config --global "code --wait"
# VSCOde가 code임 ㅋㅋ
- --wait 옵션은 command line 으로 VSCode를 실행시켰을 경우, VSCode 인스턴스를 닫을 때까지 command를 대기(즉, VSCode 종료 전까지는 커맨드에서 작업 안됨!)
- 편의에 따라 마음대로 선택하기!
Git Diff Tool 설정
- Diff : 버전간의 차이점을 조회
- Git Configuration 파일 열기
git config --global -e
# -e : 여는 옵션
- Git Diff 설정 추가
- difftool이 원래는 vim으로 설정되어있을텐데 vscode가 더 편함!
[Diff]
tool = vscode
[difftool "vscode"]
cmd = "code --wait --diff $LOCAL $REMOTE"
- -e로 VSCode 연다음에 설정 변경 후 ctrl + s or command + s로 저장
- mac의 경우 엑스로 끄면 안되고 q사용 해서 완전히 종료해야함
Git Diff
- Git Diff - Branch 간 비교 명령어
git diff <branch1> <branch2>
# ex) git diff main dev
# 이건 그냥 커맨드에서 보여주고 아래는 tool을 사용해서 보여줌
git difftool <bracnh1> <bracnh2>
# ex) difftool main dev
# tool이 vscode로 설정되어 있어 vscode로 비교하게 됨
- Git Diff - Commit 간 비교 명령어
git diff <commithash> <commithash>
git difftool <commithash> <commithash>
# Local에서는 git log 를 통해 조회 가능
# Remote Repo에서도 확인가능
- Git Diff - 마지막 Commit과 이전 Commit 비교 명령어
- HEAD HEAD^
# dev에서 확인해보자!
git checkout dev
git difftool HEAD HEAD^
- Git Diff - 마지막 Commit과 현재 수정사항 확인 명령어
- HEAD
# 변경한 뒤 확인해보자!
git checkout main
# 바뀌기 전 확인
cat hello.py
# 변경
cat > hello.py
print("hello, pig")
# ctrl + D로 빠져나오기
git difftool HEAD
- Git Diff - Local and Remote간 비교
git diff <branch> origin/<branch2>
# 일단 현재 Main Branch 상태를 Remote Repository로 push
git push origin main
# 방금 수정한 파일을 commit(Local repo의 Main Branch에만 반영됨)
git commit -m 'modify 3' hello.py
# 어느곳의(Local, Remote) main인지 비교 위해 origin같은걸 명시해줘야 함
git difftool main origin/main
- Remote repo엔 아래가 들어감
- 수정사항을 커밋 후 비교해보면 아래와 같음
- 현재까지 작업한 내용들을 확인해보자 !
- VSCode로 들어가 git Graph 확인
code .
- 누르면 변경내용도 확인가능
이전 글들을 보고 싶다면?
2022.01.03 - [컴쀼따/Git] - Git1 (Git 이란?)
Git1 (Git 이란?)
Git1 내가 처음 Git을 접했을 때 너무 어려웠다, 처음보면 다 그러니 계속봐서 익숙해지자 ! Git 이란? 버전관리 시스템(형상관리)의 한 종류 Configuration Management Systems, Version Control Systems 버전관..
variety82p.tistory.com
2022.01.03 - [컴쀼따/Git] - Git 2(Global configuration & 기본용어)
Git 2(Global configuration & 기본용어)
Git Global Configuration 기초설정! Global User name & Email 말 그대로 유저의 이름과, 이메일 등록하는 과정 git config --global user.name git config --global user.email Line ending 줄바꿈을 하거나 엔..
variety82p.tistory.com
2022.01.05 - [컴쀼따/Git] - Git3 (Local Repository, Remote Repository)
Git3 (Local Repository, Remote Repository)
Local Repository Local Repository 구성 Local Repository는 Git이 관리하는 3단계로 구성되어 있다. Working Directory(작업공간) - 실제 소스 파일, 생성한 파일들이 존재, 그냥 컴퓨터에 있는 폴더라 생각! In..
variety82p.tistory.com
2022.01.05 - [컴쀼따/Git] - Git4 ( Remote Repository 복제, 클론!)
Git4 ( Remote Repository 복제, 클론!)
Clone을 사용하여 Remote Repository를 로컬에 복제해보자! Remote Repository를 Local로 복제해서 사용하기 Local Repository를 생성하지 않은 상태에서 Git clone 명령을 사용하여 Remote Repository를 Local에..
variety82p.tistory.com
2022.01.05 - [컴쀼따/Git] - Git5 (Branch)
Git5 (Branch)
협업과 버전관리를 위한 Branch를 AraBoza! Branch 브랜치란 독립적으로 어떤 작업을 진행하기 위한 개념, 필요에 의해 만들어지는 각각의 브랜치는 다른 브랜치의 영향을 받지 않기 때문에, 여러 작
variety82p.tistory.com
2022.01.05 - [컴쀼따/Git] - Git6 (Git Graph, Git Log)
Git6 (Git Graph, Git Log)
작업이력을 확인해보자 ! 작업한 것에 대한 버전과 브랜치들을 텍스트가 아닌 시각적으로 보기 가능 VSCode - extension - Git Graph 검색 후 설치 아래 그림 클릭시 그래프 확인 가능! 실습환경 만들기 R
variety82p.tistory.com
'💻 > Git' 카테고리의 다른 글
Git9 (Git Tag) (0) | 2022.01.05 |
---|---|
Git8 (Merge and Conflict) (0) | 2022.01.05 |
Git6 (Git Graph, Git Log) (0) | 2022.01.05 |
Git5 (Branch) (0) | 2022.01.05 |
Git4 ( Remote Repository 복제, 클론!) (0) | 2022.01.05 |