branch 관련
- git branch -m [기존 이름] [변경할 이름] : 브랜치 이름 변경
- git branch -d [브랜치명] : 로컬 브랜치 제거
- git push origin --delete [branchName] : 원격 브랜치 제거
- git checkout [브랜치명] : 브랜치 변경
- git checkout -b [브랜치명] : 브랜치 생성 및 변경
commit 관련
- git commit -m "메세지"
- git commit -a : add와 동시에 commit
- git commit -am "메세지" : option -a 와 -m 을 합친 것
log 관련
- git log
- git log --graph
non-fast-forward 병합 관련
- fatal: refusing to merge unrelated histories, 원격 저장소와 로컬 저장소가 무관하고 공통된 히스토리가 없는 경우
- git pull origin main --allow-unrelated-historiesistories (강제 병합)
- Automatic merge failed; fix conflicts and then commit the result.
- 수동으로 병합을 위한 수정 처리 후 다시 commit and push
수정 이전으로 상태 되돌리기
- 가장 최신 commit 상태로 되돌리기
- git reset --hard HEAD
- commit undo 하고 변경사항은 유지하기(구체적으로는 index 유지)
- git reset --soft HEAD
Staging Area에서 잘못 add한 파일/폴더 제거하기
-
- git rm --cached 파일/폴더명 -r
'Infra > Tools' 카테고리의 다른 글
도커의 데이터 공유 방식 (0) | 2025.05.14 |
---|---|
Git Submodule 활용 (0) | 2025.02.26 |
도커 네트워크 (0) | 2025.02.11 |
[Nginx+Certbot+Let's encrpyt+Docker]https 통신을 위한 ssl(tls)인증서 등록하기 (0) | 2023.09.05 |