- Add new target remote locally
git remote add <new-remote-name> <new-remote-utl>
git push <new-remote-name> <branch-to-push>:<new-remote-branch>
git rev-parse --abbrev-ref HEAD
Delete local tag '1.0.0'
git tag -d 1.0.0
Delete remote tag '1.0.0'
git push origin :refs/tags/1.0.0
Alternative approach
git tag -d tagName
git tag | xargs git tag -d
git tag -l | xargs -n 1 git push --delete origin
to delete a lot of tags wich are very similar (i.e. 2.0.0-1, 2.0.0-2, 2.0.0-3), so this is what I did:
git tag --list '2.0.0-*' | xargs -I % echo "git tag -d %; git push --delete origin %" | sh
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
-
Delete local branch
git branch -d <branch-name>
-
Delete remote branch
git push origin --delete <branch-name>
git fetch --all && for branch in $(git branch | sed '/*/{$q;h;d};$G' | tr -d '*') ; do git checkout $branch && git merge --ff-only || break ; done