git commit

git init : 깃 시작 cd [경로] : 폴더 위치 이동 git status : 현재 파일들의 상태 확인 git add [파일 이름] : commit할 파일 추가 ([파일 이름] : . or git.css) git rm [파일 이름] : commit할 파일 삭제 git config --global user.email [이메일] : 이메일로 로그인 git config --global user.name [이름] : 이름으로 로그인 git config --global credential.helper 'store --file [경로]' : 비밀번호 저장된 파일 생성 git config --list : name과 email 잘 들어갔는지 확인 git commit -m [설명 메시지] : commit git commit -am [설명] : add와 commit 동시에 git log : commit된 내역 확인

git remote / pull / push

git remote add origin https://github.com/[githubID]/gitExample : origin으로 원격 저장소 주소 등록 git remote remove origin : origin이라는 원격 저장소 삭제 git push origin master : origin에 master(branch commit saved)를 push git pull origin master : origin의 내용이 master로 복사됨 git pull --rebase origin master : origin과 현재 로컬 저장소 동기화 git pull origin master --allow-unrelated-histories : 관련없는 저장소라도 pull git clone [저장소 주소] : 클라이언트 상에 아무것도 없을 때 서버 프로젝트 다운

git push 잘못했을 때 git reset HEAD^ git push -f origin master

git 원격 브랜치 가져오기 git checkout -t origin/[브랜치명]

git status / commit 되돌리기

git diff : 수정된 파일에서 달라진 부분 확인 git checkout [파일 이름] : modified file을 unmodified file로 git reset [파일 이름] : staged file을 (before commit) modified file로 git reset --soft [파일 이름] : (after 커밋) unmodified file을 (before 커밋) staged file로 git reset --mixed [파일 이름] : unmodified file을 modified file로 git reset --hard [파일 이름] : unmodified file을 unmodified file로 git reset HEAD~1 : commit 1개 전으로 되돌리기 git revert HEAD : 이전 commit 내용을 새 commit으로 저장 (⇒:wq)

git cherry-pick [commit명] : 다른 branch의 커밋을 골라 현재 브랜치에 합병 git tag -d [태그명] : 커밋에 태깅 git fetch : 서버의 변경점을 별개의 브랜치로 만듦 git shortlog : commit 메시지 로그 확인

git filter-branch -f --index-filter 'git rm --cached --ignore-unmatch 삭제하고자하는 file명' --prune-empty -- --all git push —force —all : 병합

git stash

git add -A : 모든 변경 내용을 staging area로 넘김 git stash : staging area에 올라간 변경사항을 변경점에 저장 git pull : github 저장소의 변경사항을 pull git stash apply : 저장한 stash 복구

git branch

git branch [브랜치 이름] : 지금 branch에서 새로운 branch 생성 git branch -d [브랜치 이름] : 로컬 branch 삭제 git push origin --delete [브랜치 이름] : 원격에 올라간 원격 branch 까지 삭제 git branch : git의 branch 확인 git checkout [브랜치 이름] : branch 간 전환 git merge [브랜치 이름] : 현재 HEAD(master)에 브랜치를 합해 새로운 커밋 생성 git merge feature : merge 중 충돌부분 확인 git rebase [브랜치 이름] : 현재 HEAD(master)에 브랜치를 합병

git lfs

git lfs install : git lfs 설치 git rm -r —cached . : 현재 파일 캐시 제거 git lfs track [파일 이름] : git lfs 추적 추가 git add .gitattributes : git attributes 파일 추가 git fsck && git gc --prune=now : git pull updating 에러 수정, 연결 및유효성 확인, 최적화 git clean -d -f -f : untracked working tree files overwritten 오류 해결 git lfs install —skip-smudge : git source tree 에러 수정 git lfs install —force : git source tree 에러 수정 git lfs untrack [파일 이름] : git lfs 추적 제거

ZeroCho Blog

[Git] git pull updating 안 멈춤