git tag
git
書き方
git tag [-a] <name> [<commit>]コミットにバージョンのような名札を付けます。git pushだけではタグは送られないので、タグ名を指定して別に押します。
よく使うオプション
| オプション | 意味 |
|---|---|
| -a | annotated tag with a message, author and date |
| -m "<msg>" | the message for -a |
| -l "<pattern>" | list tags matching a pattern |
| -d <name> | delete a tag locally |
| -f | move an existing tag |
| --sort=-creatordate | newest tag first |
例
git tag -a v1.2.0 -m "release 1.2.0"marks the current commit as a release
git push origin v1.2.0the separate step that puts the tag on the server
git tag -d v1.2.0deletes it locally; the server keeps its copy
取り消しに何通りもあるのが混乱のもとです — ブランチの指す先を動かすのと、打ち消すコミットを積むのは別です。
読み方
- 角括弧 [ ] は省いてよい部分です。
- 三点 … は複数並べられるという意味です。
- オプションは大文字小文字を区別します — -r と -R が別物のコマンドもあります。
よくある質問
Q. git tag は何をしますか。
コミットにバージョンのような名札を付けます。git pushだけではタグは送られないので、タグ名を指定して別に押します。
Q. どう打ちますか。
git tag [-a] <name> [<commit>] — 角括弧は省いてよい部分です。
Q. よく使うオプションはいくつですか。
ここにまとめたのは6個です。全部は man git にあります。このコマンドはgitの仲間です。
関連するコマンド
man ページ: man git-tag