This script automates the process of cloning all branches from a source GitHub repository, checking them out locally, changing the remote URL, and pushing all branches to a new destination repository.
- Python 3.x
- Git
-
Clone this repository
git clone <your-repo-url> cd <your-repo-directory>
-
Make the script executable
chmod +x script.py
-
Run the script with the source repository URL and the destination repository URL
python script.py <source-repo-url> <destination-repo-url>
Replace
<source-repo-url>
with the URL of the repository you want to clone from and<destination-repo-url>
with the URL of the repository you want to push to.
To clone all branches from https://github.com/Priority-Media/react-offer-sites.git
and push them to https://github.com/your-username/your-new-repo.git
, run:
python script.py https://github.com/Priority-Media/react-offer-sites.git https://github.com/your-username/your-new-repo.git