힘내 치트 시트👨‍💻

이 치트 시트는 쉽게 참조할 수 있도록 가장 중요하고 일반적으로 사용되는 Git 명령을 제공합니다.


☑️ 만들기



기존 데이터의 경우

cd ~/Projects/MyProject



git init 



git add .

기존 리포지토리에서

git clone ~existing/repo ~/new/repo



git clone [email protected]:dir/project.git

default protocol is ssh


☑️ 업데이트



원본에서 가장 최근의 변경 사항 가져오기

git fetch

this does not merge them
원점에서 가장 작은 변경 사항을 가져옵니다.

git pull

does a fetch followed by a merge
다른 사람이 보낸 패치 적용

git am -3 patch.mbox

In case of conflict, resolve the conflict and
git am --resolve



☑️ 게시



Git은 모든 로컬 변경 사항을 커밋합니다.

git commit -a


메시지와 함께 Git 커밋

git commit -m 'message'


다른 개발자를 위한 패치 준비

git format-patch origin


변경 사항을 원점으로 푸시

git push [origin] [branch]


버전 또는 이정표 만들기

git  tag <vesrion_name>


태그 푸시

git push origin Tagname


모두 태그 푸시

git push origin --tags


태그 삭제

git tag -d <Tagname>



☑️ 지점



BRANCH 브랜치로 전환

git checkout <BRANCH>


브랜치 B1을 브랜치 B2에 병합

git checkout <B2>



git merge <B1>


HEAD를 기반으로 분기 생성

git branch <BRANCH>


다른 것을 기반으로 분기 만들기

git checkout <new> <base>


분기 삭제

git branch -d <branchName>



☑️ 되돌리기



마지막 커밋 상태로 돌아가기

git checkout -f | git reset --hard

youcannot do the hard reset

마지막 커밋 되돌리기

git revert HEAD

create a new commit

마지막 커밋 수정

git commit -a -amend

after editing the broken files
파일의 ID 버전 확인

git checkout <ID> <file>



☑️ 쇼



작업 디렉토리에서 변경된 파일

git status


추적 파일로 변경

git diff


ID1과 ID2 간 변경

git diff <ID1> <ID2>


변화의 역사

git log


변경된 파일에 대한 변경 이력

git whatchanged


파일에서 누가 무엇을 언제 변경했는지

git blame <file>


ID로 식별되는 커밋

git show <ID>


특정 ID의 특정 파일

git diff <ID>:<FILE>


모든 로컬 지점

git branch

star "*" mark the current branch
패턴 검색

git grep <pattern> [path]



< 👨‍💻 시간 내주셔서 감사합니다 ....‍💻‍💻 />

좋은 웹페이지 즐겨찾기