자주 쓰는 git command 모음



// 현재 git 상황
git status

// 새로운 repo시작
git init [repository name]

// (github) 등에 있는 repo 복사
git clone [url]

// branch바꾸기
git checkout [branch name]
git checkout -b [branch name] // 새 branch생성후 사용

// branch통합
git merge [branch name]

// 파일(들)을 staging 영역에 추가
git add [file]
git add *

// 파일 삭제 및 삭제를 stage영역에 추가
git rm [file]

// stage안된 파일 다른점 비교
git diff
git diff –staged // stage영역 파일과 최신 버전 비교

// 파일을 stage영역에서 제거
git reset [file]

// 파일을 repo로 commit
git commit -m “[ Type in the commit message]”

// 로컬 파일변경된 myfile.ext를 무시하고 hard reset, @ 는 HEAD 대표함
git checkout @ -- myfile.ext
git pull

// 전체 repo를 hard reset할 경우 (모든 파일의 로컬 변경을 무시)
git checkout HEAD
git pull

// remote repo에 변경사항을 보냄
git push [variable name] master

No comments:

Post a Comment