File tree Expand file tree Collapse file tree 1 file changed +102
-0
lines changed Expand file tree Collapse file tree 1 file changed +102
-0
lines changed Original file line number Diff line number Diff line change @@ -1606,6 +1606,108 @@ git stash drop 0
16061606git stash drop stash@{0}
16071607```
16081608
1609+ ## git tag
1610+
1611+ [ Youtube Tutorial - git tag 教學] ( https://youtu.be/azciLlpr3Gs )
1612+
1613+ 查看 tag
1614+
1615+ ``` cmd
1616+ git tag
1617+ ```
1618+
1619+ ![ alt tag] ( https://i.imgur.com/8f6zGfm.png )
1620+
1621+ 指定關鍵字
1622+
1623+ ``` cmd
1624+ git tag -l "v1.*"
1625+ ```
1626+
1627+ ` -l ` ` --list `
1628+
1629+ git tag 有 輕量級標籤(lightweight tag) 和 附註標籤(annotated tag).
1630+
1631+ 輕量級標籤(lightweight tag)
1632+
1633+ 如果想要建立一個輕量級的標籤,請不要指定 ` -a ` ` -s ` (GPG-signed) ` -m `
1634+
1635+ ``` cmd
1636+ git tag tag_name [commit_id]
1637+ ```
1638+
1639+ 如果只使用 ` git tag tag_name ` , 而沒加上後面 Commit id,
1640+
1641+ 則會自動把 tag 放在目前的這個 Commit id 上.
1642+
1643+ 顯示註解
1644+
1645+ ``` cmd
1646+ git show v1.1-light
1647+ ```
1648+
1649+ 附註標籤(annotated tag)
1650+
1651+ ``` cmd
1652+ git tag -a v1.1 -m "version 1.1"
1653+ ```
1654+
1655+ ` -a ` 就是標籤名稱 ` --annotate `
1656+
1657+ ` -m ` 代表該標籤說明(註解)
1658+
1659+ 在指定的 commit 上設 tag
1660+
1661+ ``` cmd
1662+ git tag -a v1.2 -m "version 1.1" [commit_id]
1663+ ```
1664+
1665+ 顯示註解
1666+
1667+ ``` cmd
1668+ git show v1.1
1669+ ```
1670+
1671+ 輕量級標籤(lightweight tag) 和 附註標籤(annotated tag) 的差別就是是否能看到更多的細節,
1672+
1673+ 附註標籤(annotated tag) 多了更多的資訊.
1674+
1675+ 輕量級標籤(lightweight tag) 如下
1676+
1677+ ![ alt tag] ( https://i.imgur.com/4cUkdyQ.png )
1678+
1679+ 附註標籤(annotated tag) 如下
1680+
1681+ ![ alt tag] ( https://i.imgur.com/DQWB1uh.png )
1682+
1683+ 當你執行 ` git push ` 預設是不會將 tag 推到 remote.
1684+
1685+ 需要執行以下的指令, push tag 到 remote 端
1686+
1687+ ``` cmd
1688+ git push origin [tagname]
1689+ ```
1690+
1691+ 一次 push 很多 tags (將會把你全部不在 remote 端的 tag 都 push 上去.)
1692+
1693+ ``` cmd
1694+ git push origin --tags
1695+ ```
1696+
1697+ 當其他人執行 ` git clone ` 或 ` git fetch ` 就可以拿到這些 tags.
1698+
1699+ 移除本地 tag
1700+
1701+ ``` cmd
1702+ git tag -d [tagname]
1703+ ```
1704+
1705+ 刪除 remote tag
1706+
1707+ ``` cmd
1708+ git push --delete origin [tagname]
1709+ ```
1710+
16091711## git show
16101712
16111713一般來說,我只用他來看這個 commit 修改了哪些東西
You can’t perform that action at this time.
0 commit comments