ALM/SCM/VCS

git 노트

Terry Cho 2013. 5. 27. 00:52
Initializing a Repository in an Existing Directory

If you’re starting to track an existing project in Git, you need to go to the project’s directory and type

$ git init

This creates a new subdirectory named .git that contains all of your necessary repository files — a Git repository skeleton. At this point, nothing in your project is tracked yet. (See Chapter 9 for more information about exactly what files are contained in the .git directory you just created.)

If you want to start version-controlling existing files (as opposed to an empty directory), you should probably begin tracking those files and do an initial commit. You can accomplish that with a few git addcommands that specify the files you want to track, followed by a commit:

$ git add *.c
$ git add README
$ git commit -m 'initial project version'

We’ll go over what these commands do in just a minute. At this point, you have a Git repository with tracked files and an initial commit.




git clone은 무엇일까??

Working directory
Index(Staging)
Head 의 개념은 무엇일까?

--------------

VCS (Version Control System) or SCM

중앙 집중형 (CVS,Subversion) - 서버가 문제가 생기면 협업이 불가능함
분산형 (Git,Mecurial, Bazzar) - 각 클라이언트가 각각 저장소를 가지고 있으며, 서버가 문제가 생겨도 지속 적인 작업이 가능하고, 서버가 날라가도, 복구가 가능하다. 또한 중앙 집중식 이외에도, Commit에 대한 다양한 Workflow 구현이 가능하다.

특징
git는 delta를 저장하는 것이 아니라, 순간 snapshot을 저장한다.
파일을 파일명이 아니라 SHA-1 해쉬 값으로 저장함. (git 만을 통해서만 접근 가능)

파일의 상태
modified - 수정되었으나, stage나 commit되지 않은 상태 (working directory 안에 존재)
stage - 수정하였으며 곧 commit할 상태라고 표시 (staging area라는 별도 영역에 존재함)
add라는 명령어가 다른 모든 버전 관리 시스템에서는 없던 파일을 추가하는 기능이지만, git에서는 stage에 파일을 추가(add)하는 명령이다 보니, 조금 헷갈릴 수 있다.


- 코드리뷰 등에 유용하게 사용될 수 있음.
- 실제 메인에는 저장되지 않았지만, 변경 내용은 저장이 되서, 다른 사람들이 볼 수 있는 상태가 됨. 
commited - 서버에 저장된 상태 (git 디렉토리에 존재)


도구
git flow - 개발에 사용되는 몇개의 브랜치만 관리할 수 있게 해줌
master branch: 최종 릴리즈된 소스 코드만 관리
 develop : 개발중인 코드
 feature : develop branch로 부터 특정한 새로운 기능을 개발할때만 사용, 완료후 develop로 merge
 release
 hotfix branch : hot fix용 etc


gerrit - git 기반의 코드 리뷰 도구.
(이전 버전과 코드 라인비교, 라인단위 코멘트, 코드 승인 프로세스를 지원함)


git 파일들을 ${repository}/.git안에 저장되어 있으며, 각 파일들은 SHA-1 으로 파일명이 encrypt되어 있어 있어서, 그냥은 볼 수 없음


그리드형

'ALM > SCM/VCS' 카테고리의 다른 글

github 연동 방식 메모  (0) 2014.01.12
git 사용법과 소스 관리  (6) 2013.07.28
Git branch reference  (0) 2013.06.25
git 기본 command  (0) 2013.06.24
VCS 브렌치 관리 전략  (0) 2013.05.27