What & How & Why

差别

这里会显示出您选择的修订版和当前版本之间的差别。

到此差别页面的链接

两侧同时换到之前的修订记录前一修订版
后一修订版
前一修订版
software_dev:ver_ctrl:git [2023/12/15 00:40] – [merge conflict] codingharesoftware_dev:ver_ctrl:git [2023/12/15 00:53] (当前版本) – [Tagging] codinghare
行 207: 行 207:
 </code> </code>
 这一段代表了当前 ''master'' 与 ''branch'' 开始时的 ''master'' 中的内容差异。我们可以选择保留当前的 ''master'' 的修改,或是保留 ''branch'' 中对应的 ''master'' 内容。但无论如何,除了要保留的内容以外,其他所有内容(包括 git 自动产生的标记)都需要删除。 这一段代表了当前 ''master'' 与 ''branch'' 开始时的 ''master'' 中的内容差异。我们可以选择保留当前的 ''master'' 的修改,或是保留 ''branch'' 中对应的 ''master'' 内容。但无论如何,除了要保留的内容以外,其他所有内容(包括 git 自动产生的标记)都需要删除。
-===Taging===+===Tagging=== 
 +git 中可以对指定的分支做 tag: 
 +<code bash> 
 +# switch to the branch before tagging 
 +git tag <tag_name> 
 + 
 +# listing exsiting tag 
 +git tag 
 + 
 +#deleting tag 
 +git tag -d <tag_name> 
 + 
 +#deleting tag on origin 
 +git tag -d <tag_name> 
 +git push origin :refs/tags/<tagname> 
 +</code> 
 +默认的 tag 是关联到当前分支的**最新** commit 上的。如果希望对指定的 commit 打 tag (比如忘记打了),需要加上 commit id: 
 +<code bash> 
 +git tag <tag_name> <commit id / 7 digits> 
 + 
 +# creating tag with extra message 
 +git tag <tag_name> -m "your message here" <commit id> 
 + 
 +</code> 
 +打好 tag 以后就可以很方便根据 tag 查看 commit 了: 
 +<code bash> 
 +git show <tag_name> 
 +</code> 
 +tag 默认存在本地。如果要推送到远程,使用以下命令: 
 +<code bash> 
 +git push origin <tag_name> 
 + 
 +#push all tags at once 
 +git push origin --tags 
 +</code>
 ===Teamwork=== ===Teamwork===
 在多人使用 git 进行合作中,一般会需要: 在多人使用 git 进行合作中,一般会需要: