之后如何将标记添加到推送的提交中?

时间:2017-01-17 12:03:53

标签: git tags bitbucket tortoisegit

我在master分公司工作。我试图做的是为它创建一个标签。我对文件进行了更改。之后我使用了这个命令行:

git tag -a <tag_name> -m "tag information and commit message"

这似乎有效。我用过:

git describe --tags

显示使用的标签,并显示正确的标签

然后我使用TortoiseGit提交我的更改,我拉动并推动并检查标签检查标记。但是当我看到Bitbucket回购时,提交给了主分支。标签未通过。

有没有办法在之后(本地和远程)向此提交添加标记?我还没找到任何东西。在标签下提交更改的常用程序是什么?

4 个答案:

答案 0 :(得分:3)

确保将标签推送到远程。

var normalisedString =
            sourceString
            .Replace("\r\n", "\n")
            .Replace("\n\r", "\n")
            .Replace("\r", "\n")
            .Replace("\n", "\r\n");

答案 1 :(得分:3)

使用$> git push --tags会将所有标记推送/转换为远程服务器。

如果你需要推送一个特定的标签(因为如果你推动它们还没有对其他标签做出决定,或者它们可能会在以后更新或删除,或者只是你不想要要与他人分享目前),您可以使用:

$> git push origin <tag_name>

答案 2 :(得分:2)

创建标记并将其推送

  1. 打开 TortoiseGit Log Message对话框
  2. 右键单击要标记的提交,然后单击Create Tag at this version...
    enter image description here
  3. 归档Tag nameMessage,例如:
    enter image description here
    然后,您在本地
  4. 上有该标记
  5. 返回Log Message对话框,右键点击该标签标签,点击Push "tag_name"...
    enter image description here
  6. 显示
  7. Push对话框,检查所有选项是否合适,然后按OK按钮
    enter image description here
    然后,您在远程
  8. 上有该标记

    使用“同步”对话框比较本地和远程

    之间的标记

    如果您无法推送某些标签,请尝试使用Compare tags

    1. 右键单击git存储库,然后单击Git Sync...
      enter image description here
    2. 使用Compare tags功能,请参阅:
      enter image description here
    3. 如果遥控器上已有相同的名称标签,则可能会显示:(注意:这只是一例。)
      enter image description here
      首先,您必须知道以下事实:标记引用指向标记对象标记对象指向当你看到^{}时,提交对象 因此,正如您所看到的,标记对象 tag_name^{}指向本地和远程提交0bd2bfa。 但是,标记引用 tag_name指向不同的标记对象
      本地标记引用 tag_name指向d443bd1,这是标记对象
      远程标记引用 tag_name指向f6c05b7,这是另一个标记对象
    4. 如果您确定遥控器上的标签有误,可以从Sync对话框中删除它 enter image description here
    5. 然后您可以将本地一个推送到远离Sync对话框:
      enter image description here
    6. 现在,它完全相同 enter image description here

答案 3 :(得分:0)

我找到了一个有效的解决方案:

git tag -a <tag_name> <beginning of the commit hash shown in bitbucket> -m "a commit message"
git push --tags

我最初使用了另一个标签。但如果你想使用相同的,你必须先删除它: 当地人:

git tag -d <tag name>

远程:

git push --delete origin <tag name>
相关问题