This page looks best with JavaScript enabled

How to Create a New GitHub Repo from an Existing Branch

· ☕ 1 min read

I just found a handy git/GitHub workflow in a Quora post titled “How do I create a new GitHub repository from a branch in an existing repository?". And I used it, successfully, to create a new GitHub repo for my updated Drupal 8 rendition of the Wieting Theatre’s website.

The new GitHub repo is wieting-D8-DO and it was created from the wieting branch of docker-compose-drupal.

The commands I used looked something like this:

cd ~/GitHub
git clone https://github.com/SummittDweller/docker-compose-drupal.git
cd docker-compose-drupal
git checkout master
git reset --hard origin/wieting
git checkout wieting
git remote rm origin
git remote add origin https://github.com/SummittDweller/wieting-D8-DO.git
git config user.name "SummittDweller"
git config user.email summitt.dweller@gmail.com
git push -u origin master

And that’s a wrap… until next time. 😄

Share on

Mark A. McFate
WRITTEN BY
Mark A. McFate
Digital Library Applications Developer