Advertisement
Guest User

Untitled

a guest
Jul 30th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.07 KB | None | 0 0
  1. ## remote 장소 구체적인 정보 확인
  2. ```
  3. # git remote show [remote name]
  4. $ git remore show origin
  5. ```
  6.  
  7. ## tag 만들기
  8.  
  9. tag는 `Lightweight`, `Annotated` 태그가 존재
  10.  
  11. ### Annotated
  12. - 태그를 만든사람의 이름, 이메일, 태그를 만든날짜, 태그메세지 저장 가능
  13.  
  14. ```
  15. # Annotated Tag
  16. # -a 옵션을 추가해서 생성
  17. $ git tag -a v0.1 -m "first version 0.1"
  18. $ git tag
  19. v0.1
  20. ```
  21.  
  22. ```
  23. # git show [tag]로 태그정보와 커밋정보 확인
  24. $ git show v0.1
  25. ```
  26.  
  27. ### Lightweight 태그
  28. - 기본적으로 파일에 커밋 체크섬을 저장하는것뿐
  29. - `-a`, `-s`, `-m` 옵션을 사용하지 않는다.
  30. - 단순한 커밋정보만 보여준다.
  31.  
  32. ```
  33. $ git tag v0.1-lw
  34. $ git tag
  35. v0.1-lw
  36. ```
  37.  
  38. ### 나중에 태그하기
  39.  
  40. 예전 커밋에 대해서 태그달기
  41.  
  42. ```
  43. $ git log --pretty=oneline
  44. 7e96c8d01f3f38c2fc7e0481acc949ec95a9edbc fix collectstatic bug
  45. f292c4fd804c4ccfb5d405eb271ea59a39880287 refactor static file for collectstatic
  46. f9cccec5078beec09cd02c4643c0947f1a2e0480 init SkillSerializer, DeveloperSerializer, add Resume html,
  47. ```
  48.  
  49. 위와 같은 log가 있다고 했을때, `init SkillSerializer, DeveloperSerializer, add Resume html` tag 달기
  50.  
  51. ```
  52. $ git tag -a v0.3 f9ccce
  53. ```
  54.  
  55. 위와같이 입력했다면 `Annotated` 태그이기 때문에 tag에 대한 message을 입력하라고 뜰것이다.
  56.  
  57. 위 작업시 유의할 사항은 `중복 tag번호`는 안된다. 이미 만들어진 tag라면
  58.  
  59. ```
  60. fatal: tag 'v0.3' already exists
  61. ```
  62.  
  63. 위와같은 에러가 뜰것이다.
  64.  
  65. ### 태그 공유하기
  66.  
  67. **git push 명령은 자동으로 remote 서버에 태그를 전송하지 않는다.**
  68.  
  69. 그래서 별도로 Push해야 한다.
  70.  
  71. ```
  72. # git push origin [tag name]
  73. $ git push origin v0.3
  74.  
  75. # multiple tag push
  76. $ git push origin --tags
  77. ```
  78.  
  79. ### tag checkout
  80.  
  81. **태그는 브랜치와 달리 가리키는 커밋을 바꿀 수 없는 이름이기 때문에 Checkout해서 사용할 수 없다.**
  82.  
  83. 태그가 가르키는 특정 커밋기반의 브랜치를 만들어 작업하려면 아래와 같이
  84.  
  85. ```
  86. $ git checkout -b branch name v0.3
  87. Switched to a new branch 'branch name'
  88. ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement