Skip to content

Instantly share code, notes, and snippets.

@Camwyn
Last active October 13, 2016 15:08
Show Gist options
  • Save Camwyn/f2e7874815894d4cd3b2947f480bc07a to your computer and use it in GitHub Desktop.
Save Camwyn/f2e7874815894d4cd3b2947f480bc07a to your computer and use it in GitHub Desktop.
Steps to archive a git branch

##ARCHIVING A BRANCH:

  • git checkout <branch name>
  • git tag archive/<branch name> (yes, this would be "archive/fix/hot_sauce")
  • git push origin <branch name> (pushes the tag(s) to the server)
  • git checkout master (could be any branch other than the one you'r archiving, most repos have a "master")
  • git branch -D <branch name> (delete the branch locally)
  • git push origin —delete <branch name> (push the delete - delete the branch on the server)

##To re-use the branch: git checkout archive/<branch name> and then git checkout -b <branch name> to recreate the branch

@Camwyn
Copy link
Author

Camwyn commented Jul 29, 2016

This is a portion of https://gist.github.com/Camwyn/c4496d9c064d67bd41f2 that I created for working with WordPress VIP's SVN.

I created a git alias for this git ab <branchname> it's in https://gist.github.com/Camwyn/b2671739a82275d8375c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment