GIT

작업흐름

 

1. 저장소를 생성하거나 저장소를 복제해서 작업 디렉토리(working directory)를 만든다.

로컬 저장소 만들기

git init

로컬 저장소 복제하기

git clone /로컬/저장소/경로
git clone https://github.com/twitter/bootstrap.git

2. 작업할 파일을 생성한다.

파일을 추가한 후에 git status를 실행하면 아래와 같이 표시된다.

Untracked files

untracked files는 버전관리가 되지 않는 파일을 의미한다.

예제

touch index.html;
touch script.js;
git status;

실행결과

3. 파일을 스테이징 영역(staging area)에 추가(add)한다.

스테이징 영역은 저장소에 최종적으로 반영할 소스들을 선별해두는 가상의 공간이다. git add 명령을 통해서 working directory 의 파일들이 staging 상태가 되며, stataging 상태가 된 파일들은 commit 명령을 통해서 저장소에 반영된다. staging area에 포함된 파일들은 git status 명령시에 아래와 같이 표시된다.

Changes to be commited

예제

git add index.html script.js;

실습

4. 커밋(commit)한다.

commit는 변경된 소스를 저장소에 저장하는 명령으로, staging area에 있는 파일들을 대상으로 이루어진다.

실습

git commit -m 'add files';

결과

commit 후에 git status를 하면 'nothing to commit'라고 출력되면 모든 파일이 정상적으로 저장소에 반영 되었다는 의미다.

git status;

5. 리모트 저장소에 push한다.

출처 : http://www.newthink.net/2009/09/20/simple-central-git-repository/

git push origin master

 

출처 : http://dogfeet.github.com/progit/progit.ko.html

출처 : http://dogfeet.github.com/progit/progit.ko.html

 


출처 : http://dogfeet.github.com/progit/progit.ko.html

댓글

댓글 본문
버전 관리
egoing
현재 버전
선택 버전
graphittie 자세히 보기