반응형
Git Config
- 설정 목록 확인
- git confi --list
- 사용자정보 변경
- git config --global user.name "이름"
- git config --global user.email "이메일@"
- 비밀번호 재설정
- git config --global --unset user.password
Git History
- 커밋 히스토리가 중요한 이유는?
- 의미있는 커밋을 만들어서 운영하는데 도움이 되고자 한다.버그가 언제 터졌는지 파악하기 쉽다.레거시 코드를 수정할 때...
- 히스토리를 깔끔하게 만드는 3가지 머지 전략
- Create a merge commit
- Squash and merge
- Rebase and merge
Git Rebase
- 로그 합치기
- git rebase -i {원하는커밋로그의 바로 전 로그}
- 합쳐질 것들을 squash 로 설정하여 저장 후 인터렉티브모드 종료
- git status 로 수행할 명령어 확인
- 이전 로그 메시지 수정하기
- 수정할 것을 edit 로 하고 메시지 수정 후 인터렉티브모드 종료
- git status 로 수행할 명령어 확인
- git commit --amend 수행
- git rebase --continue 수행정상적으로 메시지 수정 완료
Git Tag
- git tag - 목록출력
- git tag {tag-name} - 태그생성
- git tag -d {tag-name} - 태그삭제
- git push origin {tag-name}
- tag list 명령어
- ref : https://stackoverflow.com/questions/6269927/how-can-i-list-all-tags-in-my-git-repository-by-the-date-they-were-created
Git Graph
- git log --graph --oneline
- git log --oneline --decorate
Git Rename - 브랜치 이름 변경하기
- 다른 브랜치에서 바꾸고 싶은 브랜치 이름 변경하기
- git branch -m {old-name} {new-name}
- 현재 브랜치의 이름 바꾸기
- git branch -m {new-name}
Git Reset vs Revert
둘다 되돌리기 이나 Reset은 history는 유지하지 않으나 Revert는 history를 유지한채 수행된다.
- git reset --soft
- stage 상태로 되돌린다.
- git reset --mixed
- unstaged 상태로 되돌린다.
- git reset --hard
- 이전 history를 삭제하고 되돌린다.
- git revert
- 바로 전 commit에 대해 revert해야하고 건너뛰어 더 이전의 commit을 revert하면 conflict가 발생한다.
Git Force Commit
- 가장 최근 커밋 내역 되돌리기
- git reset HEAD^
- 리모트 강제 푸시
- git push -f origin {BranchName}
Git commit log copy
- git cherry-pick {commit-log}
Git Errors
- -- fatal: refusing to merge unrelated histories
- git pull origin {branch} --allow-unrelated-histories
Git flow
- 우아한형제들 : http://woowabros.github.io/experience/2017/10/30/baemin-mobile-git-branch-strategy.html
- 아틀라시안 : https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow
- https://danielkummer.github.io/git-flow-cheatsheet/
- https://buildmedia.readthedocs.org/media/pdf/git-flow/latest/git-flow.pdf
반응형