Skip to content

Instantly share code, notes, and snippets.

@williamdes
Created September 10, 2019 11:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save williamdes/c76d3bbf0b35c1d058c69ad63772ac72 to your computer and use it in GitHub Desktop.
Save williamdes/c76d3bbf0b35c1d058c69ad63772ac72 to your computer and use it in GitHub Desktop.
Import git branch as a tag from existing branch with same name
#!/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"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment