※제로베이스 데이터 취업스쿨 11기 수강 중
📗 39번째 공부 내용 요약
저번에 이어 Git에 대해 배우고 실습해보았다.
1. Log and Diff : VS code를 통한 Git Graph 확인 및 Git Log와 Git diff 학습
2. Merge and Conflict : Branch의 Merge하는 법과 Conflict를 다루는 법 학습
📖 39번째 공부 내용 자세히
1. Log and Diff
1) Git Graph
VS code의 Extension에서 git graph 설치하고 실행
2) Git Log
Branch 별 변경 이력을 확인할 수 있음
git log
3) Git Editor 설정
git config --global core.editor <editorname> --wait
#vscode로 설정
git config --global core.editor "code --wait"
4) Git Diff Tool 설정
■ Git configuration 파일 열기
git config --global -e
■ Git Diff 설정 추가
5) Git Diff
■ Local Branch 간 비교
git diff <branch1><branch2>
git difftool <branch1><branch2>
■ Commit 간 비교
git diff <commithash><commithash>
git difftool <commithash><commithash>
■ 마지막 Commit과 이전 Commit 비교
git diff HEAD HEAD^
git difftool HEAD HEAD^
■ 마지막 Commit과 현재 수정 사항 확인
git diff HEAD
git difftool HEAD
■ Local과 Remote 간 비교
git diff <branch> origin/<branch>
git difftool <branch> origin/<branch>
2.Merge and Conflict
1) Merge Tool 설정
■ Configuration 파일 열기
git config --global -e
■ Git Merge 설정 추가
2) Merge
■ Git Merge
현재 위치한 Branch에 다른 Branch 병합
git merge <branchname>
3) Conflict
■ Merge Conflict
Branch를 Merge하는 과정에서 충돌이 날 수 있음
혹은 Push나 Pull 하는 과정에서도 충돌이 날 수 있음
# 1. Conflict 발생
git merge dev2
'''
CONFLICT (content): Merge conflict in test.txt
Automatic merge failed; fix conflicts and then commit the result.
'''
# 2. MergeTool 실행
# Conflict 발생 후 mergetool을 실행하면 Conflict난 파일이 차례로 열림(VS code)
git mergetool
# 3. Conflict 파일 수정
# 맞는 코드로 수정하고 저장한다
# 4. Conflict 해제
# git add + git commit
git add test.txt #해당하는 파일을 add
git commit
# 5. Commit Message 저장
# 4에서 git commit후 vscode로 뜨는 commit mesage를 저장해준다
➰ 39번째 후기
낯설면서도 신기한 Git~ 조금씩 익숙해지고 있다!
※본 내용은 제로베이스 데이터 취업 스쿨에서 제공하는 학습 내용에 기반합니다.
'제로베이스 데이터 스쿨 > 일일 스터디 노트' 카테고리의 다른 글
41번째 스터디노트 / SQL 과제 2 - 주유소 데이터 Python으로 Database에 저장하고 사용하기 (0) | 2023.03.07 |
---|---|
40번째 스터디노트 / SQL 과제 1 - 스타벅스, 이디야 매장 데이터 Python으로 Database에 저장하고 사용하기 (0) | 2023.03.02 |
38번째 스터디노트 / 버전관리, Git, Local Repository, Remote Repository (0) | 2023.02.24 |
37번째 스터디노트 / SQL 심화 - 서브쿼리, 스칼라 서브쿼리, 중첩 서브쿼리, 인라인뷰 (0) | 2023.02.23 |
36번째 스터디노트 / SQL 심화 - Scalar Function, EDA 학습 과제 2 (0) | 2023.02.22 |