ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • Git tag
    Dev/Git 2020. 1. 29. 19:23
    반응형

    git tag 명령을 사용하면 특정 시점에 책갈피처럼 표시를 해두고 해당 커밋을 필요할 때 바로 찾아볼 수 있다. 

    $ git tag -a V-0.1

    위와 같이 실행하면 커밋을 생성할 때와 동일하게 태그에 대한 메세지를 남길 수 있는 창이 열린다.

    이곳에 태그관련 설명을 적는다. 
    
    아래는 자동으로 생성된 메세지, 저장하고 나가면 아래 글들은 자동으로 사라진다.
    #
    # Write a message for tag:
    #   V-0.1
    # Lines starting with '#' will be ignored.
    

      저장한 후 생성한 태그들을 검색해본다. 

    $ git tag
    // 또는
    $ git tag -l
    // 또는 
    $ tag tag --list
    V-0.1

    생성한 태그로 체크아웃을 해보면 아래의 메세지가 뜬다. 

    해당 커밋을 살펴볼 수는 있지만 작업하려면 브렌치를 생성해야 된다며 'git checkout -b <생성할 브렌치명> 을 입력해야 된다고 설명하고 있다. 

    $ git checkout V-0.1
    Note: checking out 'V-0.1'.
    
    You are in 'detached HEAD' state. You can look around, make experimental
    changes and commit them, and you can discard any commits you make in this
    state without impacting any branches by performing another checkout.
    
    If you want to create a new branch to retain commits you create, you may
    do so (now or later) by using -b with the checkout command again. Example:
    
      git checkout -b <new-branch-name>
    
    HEAD is now at 23c6e4f Refactor welcome controller and view
    Note: checking out 'V-0.1'.
    
    You are in 'detached HEAD' state. You can look around, make experimental
    changes and commit them, and you can discard any commits you make in this
    state without impacting any branches by performing another checkout.
    
    If you want to create a new branch to retain commits you create, you may
    do so (now or later) by using -b with the checkout command again. Example:
    
      git checkout -b <new-branch-name>
    
    HEAD is now at 23c6e4f Refactor welcome controller and view
    

     

    그외 기타 자세한 설명을 메뉴얼 페이지를 참조할 수 있다. 

    $ git tag -h
    usage: git tag [-a | -s | -u <key-id>] [-f] [-m <msg> | -F <file>] <tagname> [<head>]
       or: git tag -d <tagname>...
       or: git tag -l [-n[<num>]] [--contains <commit>] [--no-contains <commit>] [--points-at <object>]
    		[--format=<format>] [--[no-]merged [<commit>]] [<pattern>...]
       or: git tag -v [--format=<format>] <tagname>...
    ...
        --format <format>     format to use for the output
        --color[=<when>]      respect format colors
        -i, --ignore-case     sorting and filtering are case insensitive
    
    반응형

    'Dev > Git' 카테고리의 다른 글

    git reset --hard/--soft <commit>  (0) 2020.02.19
    git 특정 파일의 변경 이력 찾기  (0) 2020.02.19
    Git 간단한 사용법 - show  (0) 2019.08.05
    Git 간단한 사용법 - log  (0) 2019.07.09
    Git 간단한 사용법 - alias  (0) 2019.07.01
Designed by Tistory.