-
Switch to the main branch:
git checkout master
-
Tag the branch and push to origin:
git tag archive/some-old-branch some-old-branch git push --tags
-
Delete the local and remote branch:
git branch -d some-old-branch git push origin :some-old-branch
-
Bonus: To restore a branch from an archive tag:
git checkout -b restored-branch archive/some-old-branch
git branch --sort=committerdate