본문 바로가기

Project 자료수집

GIT 사용법

간략한 사용법 요약.

settings
.bashrc에 아래내용추가 (위에 두줄은 본인것으로)
# for GIT
USER_NAME='YOURNAME'
USER_EMAIL='YOUREMAIL'
GIT_AUTHOR_NAME=${USER_NAME}
GIT_AUTHOR_EMAIL=${USER_EMAIL}
GIT_COMMITTER_NAME=${USER_NAME}
GIT_COMMITTER_EMAIL=${USER_EMAIL}
export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL GIT_COMMITTER_NAME GIT_COMMITTER_EMAIL

home directory에 .gitconfig 파일 생성해서 아래내용 복사
[color]
branch = auto
diff = auto
status = auto
commit = auto
[core]
editor = vim

repository 받아오기
# git clone git@[PATH]

repository 상태보기
# git status

Changes to be committed
add된 파일들

Changed but not updated
수정했지만 커밋되지 않을 파일들

Untracked files
git repository에 등록되지 않은 파일들

repository 최신상태로 (update된 commit을 받아옴)
# git pull
conflict를 예방하기 위하여 작업하기전에 항상 pull을 하고 작업을 시작함

pull했을때 conflict 났을경우
# git stash
local repository의 patch를 저장하고 해당 branch의 HEAD상태로 reset

# git pull
update된 commit을 받아옴

# git stash apply
local repository의 patch를 다시 적용 (같은 파일 수정시 conflict 날 가능성 있음)

작업내용 commit 과정
# git status
commit할 파일들 확인

# git pull
conflict를 예방하기 위하여 repository를 최신상태로 만듬

모든파일을 commit할 경우
# git commit -a -s

특정파일만 commit할 경우
# git add [file]
위 명령으로 파일을 add한 후에
# git commit -s

commit message창에서 commit내용을 자세히 기술후 저장하고 나옴

# git push
commit내용 repository에 반영

commit Log 보기
# git log

파일이동
# git mv [file]

파일삭제
# git rm [file]

파일원래 상태로 되돌리기 (복원불가능하니 신중히)
# git checkout [file]

repository를 특정 commit으로 reset하기 (수정한 내용 저장안됨 백업은 알아서)
# git reset --hard [commit ID]


'Project 자료수집' 카테고리의 다른 글

RAP 개발을 위한 각종 링크  (0) 2013.08.20
TourAPI Sample Source  (2) 2013.08.20
UPnP 관련 URL  (0) 2013.07.16
오픈소스 홈네트워크 프로그램 (UPnP)  (0) 2013.07.02
UPnP 구성요소 동작 순서  (0) 2013.05.08