Skip to content

Instantly share code, notes, and snippets.

@williamdes
Created September 10, 2019 11:50
Show Gist options
  • Select an option

  • Save williamdes/c76d3bbf0b35c1d058c69ad63772ac72 to your computer and use it in GitHub Desktop.

Select an option

Save williamdes/c76d3bbf0b35c1d058c69ad63772ac72 to your computer and use it in GitHub Desktop.

Revisions

  1. williamdes created this gist Sep 10, 2019.
    10 changes: 10 additions & 0 deletions import_branch_to_tag.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    #!/bin/bash

    # git: Having a branch/tag with the same name (error: dst refspec matches more than one.)
    # run git branch --all and use a text editor to create a batch of commands
    git tag -m "[imported from branch]" --force --sign "release/2019-09-10-1" $(git show-ref --hash "refs/remotes/origin/release/2019-09-10-1")

    # https://markhneedham.com/blog/2013/06/13/git-having-a-branchtag-with-the-same-name-error-dst-refspec-matches-more-than-one/

    # Delete ref from remote
    git push origin :"refs/heads/release/2019-09-10-1"