Skip to content

Instantly share code, notes, and snippets.

@floriankapaun
Created May 26, 2023 06:10
Show Gist options
  • Save floriankapaun/b2ed0933ec678fb634a0b76b9d264074 to your computer and use it in GitHub Desktop.
Save floriankapaun/b2ed0933ec678fb634a0b76b9d264074 to your computer and use it in GitHub Desktop.
Archive Git Branch
# Create a tag for the branch that you want to archive.
# This allows to restore the branch later.
git tag archive/<branchname> <branchname>

# Push the newly created tag.
git push --tags

# Delete the branch
git branch -D <branchname>

# Push the deleted branch
git push origin :<branchname>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment