by shigemk2

当面は技術的なことしか書かない

前のコミットにGitのタグをつけたり、削除したり

概要

  • dオプションでタグを削除
  • いったんcheckoutしてHEADをずらしてからtagをつける

サンプル

$ [master] git checkout 6165ffb
Note: checking out '6165ffb'.

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 6165ffb... Bug fix when image_file is nil
$ [6165ffb] git tag v1
$ [6165ffb] gcm
Previous HEAD position was 6165ffb... Bug fix when image_file is nil
Switched to branch 'master'
$ [master] glo
b78dd78 (HEAD, origin/master, master) Fix
4f0b264 Fix client
6165ffb (tag: v1) Bug fix when image_file is nil
2e341ab Destinate image download path
c6a960a Update gemspec
1e759ff Add methods for image
1c14d3b Add test
dd3a341 Add license
6a084c5 Add service_status method
4a69b30 Create keio-line.gemspec
90726c9 Initialize repository

リンク

Git tag older commit? - Stack Overflow
clmemo@aka: Git でリモート・リポジトリーのタグを削除する