How do you push a tag to a remote repository using Git?

前端 未结 9 1035
滥情空心
滥情空心 2020-11-22 16:31

I have cloned a remote Git repository to my laptop, then I wanted to add a tag so I ran

git tag mytag master

When I run git tag

9条回答
  •  庸人自扰
    2020-11-22 17:25

    To expand on Trevor's answer, you can push a single tag or all of your tags at once.

    Push a Single Tag

    git push  
    

    This is a summary of the relevant documentation that explains this (some command options omitted for brevity):

    git push [[ […]]
    
    ...
    

    The format of a parameter is…the source ref , followed by a colon :, followed by the destination ref

    The tells which ref on the remote side is updated with this push…If : is omitted, the same ref as will be updated…

    tag means the same as refs/tags/:refs/tags/.

    Push All of Your Tags at Once

    git push --tags 
    # Or
    git push  --tags
    

    Here is a summary of the relevant documentation (some command options omitted for brevity):

    git push [--all | --mirror | --tags] [ […]]
    
    --tags
    

    All refs under refs/tags are pushed, in addition to refspecs explicitly listed on the command line.

提交回复
热议问题