Is there a simple command to convert a branch to a tag?

The answers given are basically correct.

As tags and branches are just names for objects, there is a simpler way without touching current work area:

git tag <name_for_tag> refs/heads/<branch_name> # or just git tag <name_for_tag> <branch_name>
git branch -d <branch_name>

Or even do it to remote server without touching local repository at all:

git push origin origin/<branch_name>:refs/tags/<tag_name>
git push origin :refs/heads/<branch_name>

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)