Aller au contenu

Create New Repo from Branch#

Bash
# Step 1: Clone the existing repository
git clone <existing-repo-url> new-repo

# Step 2: Navigate to the new repository directory
cd new-repo

# Step 3: Checkout the specific tag
git checkout tags/<tag-name> -b <new-branch-name>

# Step 4: Delete the existing main branch
git branch -D main

# Step 5: Rename the new branch to main
git branch -m main

# Step 6: Remove the existing remote
git remote remove origin

# Step 7: Create a new repository on your Git hosting service (e.g., GitHub, GitLab) and get the new repository URL

# Step 8: Add the new remote repository URL
git remote add origin <new-repo-url>

# Step 9: Push the new main branch to the new repository
git push -u origin main

# Step 10: Push Tags to the new repository
git push --tags