Git
둘러보기로 가기
검색하러 가기
오픈소스 분산 버전 컨트롤 시스템인 git를 정리 한다.
- 홈페이지 : http://git-scm.com/
- 다운로드 : http://git-scm.com/download
- 라이선스 :
- 플랫폼 :
Git 개요
Git은 로컬 저장소를 가지며 SnapShot 형태로 버전을 관리 합니다.
Git 저장소
- Work Space : 개인별 작업 공간
- Staging Area (index) : Commit할 파일을 지정 (git add)
- 로컬 저장소 : 자신이 작업한 내용을 반영 (git commit, git commit -a)
- 원격 저장소 : 다른 사람과 작업을 공유할 때 사용 (git push / git pull (git fetch, git merge))
- Work Space -> Staging Area (index) -> Local Storage -> Remote Storage
Master and Branch
- Master : 메인 코드 (git checkout master, git merge branch)
- Branch : 새로 작업을 위해 생성한 코드 (git branch, git checkout, git checkbout -b)
Git 설치
Windows에서 git 설치
Git 다운로드 사이트에서 Windows용 Git 설치 파일(Git-1.9.4-preview20140815.exe)을 다운로드하여 설치 합니다.
P:/001_work/gitRepositor/ 폴더를 만들고 해당 폴더에서 오른쪽 마우스를 클릭 합니다.
참고 문헌
- http://forum.falinux.com/zbxe/index.php?document_srl=588283&mid=lecture_tip
- http://insanehong.kr/post/guide-to-git-for-windows/
CentOS에서 git 설치
Git 설치
yum install git git version |
Git 환경 설정
groupadd git su - git |
Git 명령어
- 저장소 : Work Space -> Staging Area (index) -> Local Storage -> Remote Storage
- 버전 : Master, Branch
분류 | 명령어 | 상세 |
초기 설정 | git init | 로컬 저장소 생성 |
git remote add <repository> | 리모트 저장소 연결 Repository : user@password:/~/~ | |
git clone <repository> | 로컬 저장소로 리모트 저장소 복제 | |
저장하기 | git add | Staging Area로 추가 |
git reset HEAD | Staging Area에 추가할 파일을 삭제 | |
git commit | 로컬 저장소로 commit | |
git commit -a | git add + git commit | |
git fetch origin git reset --hard origin/master |
로컬 저장소로 commit한 것을 복구 | |
git push | 리모트 저장소로 commit | |
가져오기 | git fetch | 로컬 저장소로 가져오기 |
git merge | 로컬 저장소의 소스와 병합 | |
git pull | git fetch + get merge | |
버전 관리 | git branch ~ | 브랜치 생성 |
git checkout ~ | ||
git checkout -b ~ | git branch + git checkout | |
git branch -d ~ | 브랜치 삭제 | |
git checkout master | ||
git merge branch | 브랜치 병합 | |
git branch git branch --no-merged git branch --merged |
브랜치 목록 | |
태그 관리 | git tag ~ git tag -a ~ |
태그 생성 |
git tag -d ~ | 태그 삭제 | |
git tag | 태그 목록 |
참고 문헌
- GitHub
- CVS
- Subversion
- "민짱의 작업실"의 GIT 사용법 (ProGIT)
- http://git-scm.com/downloads : 설치프로그램 다운로드