ALM/SCM/VCS

git 기본 command

Terry Cho 2013. 6. 24. 23:23


1. git 기본 사용법

$ echo "test materials" > index.html

$


repository 생성

$ git init

Initialized empty Git repository in c:/dev/git/.git/

$ echo "This is test materials" > init.html

$ echo "This is test materials" > index.html

$ git add index.html

warning: LF will be replaced by CRLF in index.html.

The file will have its original line endings in your working directory.

$ git status

# On branch master

#

# Initial commit

#

# Changes to be committed:

#   (use "git rm --cached <file>..." to unstage)

#

#       new file:   index.html

#

# Untracked files:

#   (use "git add <file>..." to include in what will be committed)

#

#       init.html

$ git commit -m "Initial contents" --author="Terry <bwcho75@gmail.com>"

[master (root-commit) eb86eb0] Initial contents

 Author: Terry <bwcho75@gmail.com>

warning: LF will be replaced by CRLF in index.html.

The file will have its original line endings in your working directory.

 1 file changed, 1 insertion(+)

 create mode 100644 index.html

 

수정 하기

$ echo "append" >> index.html

$ git add index.html

$ git commit -m "append"


commit history 확인

$git log master



2.태깅

$git tag -a 0.2 -m "v0.2 tagging"


태그 버전들 확인하기

$git tag


각 태그 버전으로 이동하기

$git reset --hard <태그명>


3. 브렌치


생성

$git branch "브렌치이름"

브렌치 목록 보기

$git branch 

- 현재 사용중인 branch는 *표로 보임


브렌치 전환하기

$git checkout "브렌치이름"

메인 master로 전환하기

$git checkout "master"


merge 하기 (현재 브렌치에, 브렌치명의 파일들을 합치기)

$git merge "브렌치명"


tag와 branch의 차이

- tag는 그 순간의 스냅샷을 보관하기 위함

- branch는 그 순간부터 붙여서 계속 해서 개발해나가기 위함





그리드형

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

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