This script transfers the commit history from a GitLab repository to Github. It performs the following tasks:
- Clones the GitLab repository locally.
- Removes files from the Git history with specified extensions such as Images and gifs to speed up the process.
- Adds a remote pointing to the GitHub repository.
- Pushes the filtered commit history to a new branch on the GitHub repository.
- Merges the new branch into the existing GitHub repository.
- Python installed.
- Both GitLab and GitHub repositories accessible with the appropriate permissions.
-
Clone this repository to your local machine:
git clone <repository-url>
-
Navigate to the directory containing the script:
cd <repository-directory>
-
Run the script
gl2gh.py
with the following command, provide the URLs of the GitLab and GitHub repositories as arguments:python gl2gh.py <gitlab_repo_url> <github_repo_url>
Replace
<gitlab_repo_url>
with the URL of the GitLab repository and<github_repo_url>
with the URL of the GitHub repository.
- Ensure that you have the necessary permissions to clone, push, and merge branches in both the GitLab and GitHub repositories.
- Review the
SKIP_EXTENSIONS
list in the script to verify that it matches the file extensions you want to exclude from the transfer.
This script is licensed under the MIT License.