Header

  1. View current page

    kkamagui의 프로그래밍 작업실

Profile_image?t=1221830958&type=big
온갖 자료가 난무하는 kkamagui의 Springnote~!!!
163

13 Git 사용법

13.Git 사용법

 

들어가기 전에...

 

1.Git에 user.name과 user.email 설정

사용자가 kkamagui이고 email이 kkamagui@gmail.com이라면 아래와 같이 입력하면 된다.

  1. $>git config --global user.name "kkamagui"
  2. $>git config --global user.email "kkamagui@gmail.com"

 

2.Git에 설정된 global config 값들 표시

  1. $>git config --global --list

 

3.표시되는 메시지를 컬러로 보기

Git에서 표시되는 메시지는 기본적으로 단색이다. 그런데 이를 컬러로 보고 싶다면 아래와 같이 입력하면 된다.

  1. $>git config --global color.ui "auto"

 

4.문자셋 설정하기

Git에서 사용하는 문자셋은 기본적으로 UTF-8이다. 만약 UTF-8이 아닌 EUC-KR을 사용하고 싶다면 아래처럼 입력하면 된다.

  1. $>git config --global i18n.commitEncoding cp949
  2. $>git config --global i18n.logOutputencoding cp949

 

5.내장 도움말 보기

Git에서 내장된 도움말을 보고 싶다면 아래처럼 입력하면 된다.

  1. $>git help <command>

 

예를 들어 commit에 대한 도움말을 보고 싶다면 git help commit과 같이 입력하는 식이다.

 

6.Git Project 생성하기

testgit 디렉토리를 만들어서 Git으로 버전관리를 하고 싶다면 아래와 같이 입력하면 된다.

  1. $>mkdir testgit
  2. $>cd testgit
  3. $>git init
  4. Initialized empty Git repository in /home/kkamagui/project/testgit/.git/

 

7.저장소에 파일 추가하기

testgit에 a.txt 파일을 추가하고 싶다면 아래와 같이 입력하면 된다.

  1. $>git add a.txt

 

8.저장소의 상태 확인하기

  1. testgit 디렉토리의 상태를 알고 싶으면 아래와 같이 입력하면 된다.
    $>git status
  2. kkamagui@ubuntu:~/project/testgit$ git status
    # On branch master
    #
    # Initial commit
    #
    # Changes to be committed:
    #   (use "git rm --cached <file>..." to unstage)
    #
    #    new file:   a.txt
    #

 

9.변경사항 로컬 저장소에 저장하기

변경사항을 로컬 저장소(Local Repository)에 저장하고 싶다면 아래와 같이 입력한다.

  1. $>git commit -m "최초 추가"
    [master (root-commit) 237a76b] 최초 추가
     1 files changed, 3 insertions(+), 0 deletions(-)
     create mode 100644 a.txt

 

10.변경 이력 보기

변경 이력(Commit Log)를 보고 싶다면 아래와 같이 입력한다.

  1. $>git log
  2. commit 237a76b9f3ccd65df523d6434d5ea4fa14142079
    Author: kkamagui <kkamagui@gmail.com>
    Date:   Wed Nov 30 10:57:13 2011 +0900

        최초 추가

 

변경 이력이 많을 경우 범위를 개수를 제한할수 있는데, -숫자를 입력하면 된다. 예를 들어 최근 변경 이력 하나만 보고 싶다면 아래와 같이 입력한다.

  1. $>git log -1

 

History

Last edited on 11/30/2011 11:13 by kkamagui

Comments (0)

You must log in to leave a comment. Please sign in.