svn만 쓰다가 git을 쓰려고 하는데 자주 안쓰니 자꾸 까먹는다.

다음 사이트를 가보니 아주 명쾌하다.


https://rogerdudler.github.io/git-guide/index.ko.html


일부 내용을 요약하자면


새로운 리파지토리를 만들려면


git init


현재 작업 내용을 추가 후 커밋하려면


git add *

git commit -m "메시지"


변경 내용을 원격 서버에 저장하려면, 먼저 원격 서버를 등록한다음 push


git remote add origin 원격서버주소

git push origin master


디렉토리 일부는 git 관리 대상에서 제외하려면 .gitignore에 디렉토리명 등록 및 삭제, 커밋, push


.gitignore에 해당 디렉토리 추가

git rm -r 디렉토리명

git commit -m "디렉토리 삭제"

git push origin master


커밋 로그 보기


git log


커밋 로그 가독성 있게 커스터마이즈하기


git log --pretty=format:"%cd - %an, %ar : %s"


커스터마이즈한 커맨드 alias로 등록하기


git config --global alias.clog 'log --pretty=format:"%cd - %an, %ar : %s"'


커밋 수정하기


git commit --amend


리모트 저장소의 업데이트 내용 자동으로 머지하기


git pull



파일을 원상태로 복구하기


git checkout -- <file>



git status로 한글이 escape처리되어 읽을 수 없는 경우 


git config --global core.quotepath false



참고정보

  • svn / git 비교표 : http://gmatcentral.org/display/GW/SVN+and+Git+Command+Mappings


+ Recent posts