How to convert an old branch into a tag on GitHub

My first really serious project on GitHub some time ago completely changed the stack - from Python to NodeJS. However, while the full git noob, I created a branch with all the Python code, and then deleted everything on the main branch and started deploying the system in NodeJS.

Now I'm still git noob, but I realized that I had to use a tag instead of a branch. So I have an old_python branch hanging there and it annoys me.

How can I get rid of this thread, but still can take a quick look at the Python code that will be the tag? I do not plan to comment anything based on Python code, so the branch seems unnecessary.

Or maybe I don’t completely understand what tags are for, and should leave it / do something else.

+4
source share
1 answer

Create tag

 git tag <tagname> origin/old_python 

Delete the branch (if you have a local branch)

 git branch -d old_python 

Click tag

 git push --tags origin 

Delete remote branch

 git push origin :old_python 
+6
source

Source: https://habr.com/ru/post/1481845/


All Articles