hmu332233 / tips

https://tips.minung.dev
1 stars 0 forks source link

git #6

Open hmu332233 opened 4 years ago

hmu332233 commented 4 years ago

git stash

$ git stash list
$ git stash show # 0번의 변경사항 요약 보기
$ git stash show -p # 0번의 변경사항 자세히 보기
$ git stash show -p stash@{1}
$ git stash clear # stash list 모두 제거

staged file diff

$ git diff --staged
// 또는
$ git diff --cached

tag 기반 브랜치 생성

$ git checkout tags/v1.0.0 -b tags/v1.0.0

stage 상태인 파일 unstage 상태로 변경하기

$ git reset HEAD [파일 이름]
$ git reset HEAD . // 모든 파일

충돌 없이 pull 받기 (rebase하면서 pull 받기)

$ git pull --rebase

rebase 실패시 재시작

$ git rebase --continue

git bisect

추후 작성 예정

hmu332233 commented 3 years ago

.gitconfig

alias

사용자로부터 입력 받는 예제

[alias]
lint = "!f() { git commit -m \"refactor: $1 lint 적용\"; }; f"

pager

pager 사용 여부

[pager]
        branch = false // branch에서는 pager를 사용하여 출력하지 않겠다.

git config --global pager.branch false

vim

commit message editor를 vim으로 사용

[core]
        editor = vim

git config --global core.editor "vim"

hmu332233 commented 3 years ago

Commit Message Convention

feat : 새로운 기능 추가
fix : 버그 수정
docs : 문서 수정
style : 코드 포맷팅, 세미콜론 누락, 코드 변경이 없는 경우
refactor : 코드 리펙토링
test : 테스트 코드, 리펙토링 테스트 코드 추가
chore : 빌드 업무 수정, 패키지 매니저 수정
hmu332233 commented 2 years ago

빈 디렉토리 commit 방법

비어있기를 희망하는 디렉토리에 .gitignore 파일을 추가하고 아래와 같이 넣는다.

# Ignore everything in this directory
*
# Except this file
!.gitignore