Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save nocash/393745 to your computer and use it in GitHub Desktop.
Save nocash/393745 to your computer and use it in GitHub Desktop.
git stash # Stash changes if any
git symbolic-ref HEAD refs/heads/${NEW_BRANCH} # Change head to a new, non-existing ref
git rm -rf . # Delete files from version control and working directory
rm -r . # Delete files from file system
git commit --allow-empty -m "Created new branch ${NEW_BRANCH}" # Commit changes in the new branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment