Skip to content

Instantly share code, notes, and snippets.

@lovejavaee
Created May 30, 2018 12:42
Show Gist options
  • Save lovejavaee/4b6928b44edc534fa8d7fc9c03b7b775 to your computer and use it in GitHub Desktop.
Save lovejavaee/4b6928b44edc534fa8d7fc9c03b7b775 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 -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