Universal Git platform migration with flexible author handling
Created by Dev Kraken | https://devkraken.com | [email protected]
- Overview
- Quick Start
- Installation
- Features
- Usage
- Author Modes
- Platform Support
- Configuration
- Examples
- Troubleshooting
- Contributing
- License
The Git Migration Tool v2.1.0 is a comprehensive solution for migrating repositories between any Git platforms with advanced author handling capabilities. Whether you're moving from GitLab to GitHub, GitHub to BitBucket, or any combination of Git platforms, this tool provides a seamless, safe, and feature-rich migration experience.
- π Universal Platform Support: GitHub β GitLab β BitBucket β Any Git Platform
- π₯ Three Flexible Author Modes: Preserve, Selective, or Unified authorship
- π‘οΈ Safety First: Comprehensive dry-run mode and validation
- π§Ή Repository Optimization: Automatic cleanup and optimization
- π Detailed Logging: Full audit trail of migration process
- π― Interactive Mode: User-friendly guided setup
For the fastest setup, use interactive mode:
# Clone the repository
git clone https://github.com/dev-kraken/git-migration-tool.git
cd git-migration-tool
# Make executable and run
chmod +x git-migration-tool.sh
./git-migration-tool.sh --interactive
For global installation:
# Install globally (recommended)
chmod +x install-global.sh
./install-global.sh
# Use from anywhere
git-migration-tool --interactive
# Clone the repository
git clone https://github.com/dev-kraken/git-migration-tool.git
cd git-migration-tool
# Make scripts executable
chmod +x git-migration-tool.sh install-global.sh
chmod +x examples/*.sh
# Install globally with automatic setup
./install-global.sh
# Verify installation
git-migration-tool --help
# Download main script only
curl -O https://raw.githubusercontent.com/dev-kraken/git-migration-tool/main/git-migration-tool.sh
chmod +x git-migration-tool.sh
# Run in standalone mode
./git-migration-tool.sh --help
The tool automatically installs required dependencies:
- Git (required)
- Python 3 (required)
- git-filter-repo (auto-installed)
- GitHub β GitLab β BitBucket
- AWS CodeCommit β Azure DevOps
- SourceForge β Generic Git servers
- Auto-platform detection from URLs
- Preserve Mode (Default): Keep all original commit authors
- Selective Mode: Change specific author only
- Unified Mode: Convert all commits to single author
- Dry Run Mode: Test migrations without changes
- URL Validation: Comprehensive repository URL checking
- Platform Validation: Ensure compatible source/target
- Backup Integration: Automatic backup creation
- Interactive Mode: Guided setup with auto-detection
- Verbose Logging: Detailed progress tracking
- Progress Indicators: Real-time migration status
- Error Recovery: Robust error handling and recovery
- Large File Cleanup: Remove/reduce oversized files
- History Optimization: Streamline commit history
- Gitignore Enhancement: Improved ignore patterns
- Branch Management: Handle multiple branches and tags
git-migration-tool [OPTIONS] COMMAND
migrate
- Full migration between platformssync
- Synchronize changes between repositorieshelp
- Show detailed help information
Option | Description | Example |
---|---|---|
-i, --interactive |
Interactive mode (recommended) | --interactive |
-d, --dry-run |
Test run without changes | --dry-run |
-f, --force |
Skip confirmations | --force |
-v, --verbose |
Detailed logging | --verbose |
--max-size SIZE |
Maximum file size | --max-size 50M |
--main-branch-only |
Migrate only main branch | --main-branch-only |
Universal Syntax (Recommended):
--source-url URL # Source repository URL
--target-url URL # Target repository URL
--from URL # Source URL (short form)
--to URL # Target URL (short form)
Legacy Syntax (Still Supported):
--gitlab-url URL # GitLab repository URL
--github-url URL # GitHub repository URL
Mode | Options | Description |
---|---|---|
--preserve |
None | Keep original authors (default) |
--selective |
--source-name , --source-email --target-name , --target-email |
Change specific author only |
--unified |
--target-name , --target-email |
Convert all to single author |
Keep all original commit authors unchanged
git-migration-tool --preserve \
--from "https://gitlab.com/user/repo.git" \
--to "https://github.com/user/repo.git" \
migrate
Use Case: Standard migrations where author history is important
Change commits from one specific author only
git-migration-tool --selective \
--source-name "Old Developer" \
--source-email "[email protected]" \
--target-name "New Developer" \
--target-email "[email protected]" \
--from "https://gitlab.com/company/repo.git" \
--to "https://github.com/company/repo.git" \
migrate
Use Case: Employee transitions, email changes, or rebrand specific author
Convert ALL commits to a single author
git-migration-tool --unified \
--target-name "Dev Kraken" \
--target-email "[email protected]" \
--from "https://github.com/client/repo.git" \
--to "https://gitlab.com/mycompany/repo.git" \
migrate
Use Case: Client work, personal branding, or company standardization
Platform | Status | URL Examples |
---|---|---|
GitHub | β Full | https://github.com/user/repo.git |
GitLab | β Full | https://gitlab.com/user/repo.git |
BitBucket | β Full | https://bitbucket.org/user/repo.git |
AWS CodeCommit | β Full | codecommit::region://repo-name |
Azure DevOps | β Full | https://dev.azure.com/org/project/_git/repo |
SourceForge | β Basic | https://sourceforge.net/p/project/code/ |
Generic Git | β Basic | Any valid Git URL |
β Fully Tested:
- GitHub β GitLab
- GitLab β GitHub
- GitHub β BitBucket
- GitLab β BitBucket
β Supported (Auto-detected):
- Any Git Platform β Any Git Platform
# Guided setup with auto-detection
git-migration-tool --interactive
# Set default author for unified mode
export GIT_MIGRATION_AUTHOR_NAME="Dev Kraken"
export GIT_MIGRATION_AUTHOR_EMAIL="[email protected]"
# Set default directories
export GIT_MIGRATION_LOG_DIR="$HOME/.git-migration-tool/logs"
export GIT_MIGRATION_TEMP_DIR="/tmp/git-migration"
# ~/.git-migration-tool/config.yml
default:
author_mode: preserve
dry_run: true
verbose: true
max_file_size: "10M"
profiles:
work:
target_name: "Work Account"
target_email: "[email protected]"
personal:
target_name: "Dev Kraken"
target_email: "[email protected]"
# Start interactive guided setup
git-migration-tool --interactive
# Preserve all authors - any platform to any platform
git-migration-tool --preserve \
--from "https://github.com/user/repo.git" \
--to "https://gitlab.com/user/repo.git" \
migrate
# Test migration without making changes
git-migration-tool --dry-run --verbose \
--unified \
--target-name "Dev Kraken" \
--target-email "[email protected]" \
--from "https://bitbucket.org/team/project.git" \
--to "https://github.com/team/project.git" \
migrate
# Change specific author during migration
git-migration-tool --selective \
--source-name "Former Employee" \
--source-email "[email protected]" \
--target-name "Current Maintainer" \
--target-email "[email protected]" \
--from "https://gitlab.com/oldcompany/legacy.git" \
--to "https://github.com/newcompany/legacy.git" \
migrate
# Sync changes between existing repositories
git-migration-tool --force \
--from "https://gitlab.com/source/repo.git" \
--to "https://github.com/target/repo.git" \
sync
# Traditional GitLab to GitHub migration
git-migration-tool --preserve \
--gitlab-url "[email protected]:company/project.git" \
--github-url "[email protected]:company/project.git" \
migrate
# Migrate only main branch (clean migration)
git-migration-tool --preserve \
--main-branch-only \
--from "https://gitlab.com/company/repo.git" \
--to "https://github.com/company/repo.git" \
migrate
# Handle large repositories with file size limits
git-migration-tool --preserve \
--max-size "50M" \
--verbose \
--from "https://gitlab.com/big/repo.git" \
--to "https://github.com/big/repo.git" \
migrate
# Run multiple example migrations
cd examples/
./migrate-preserve-authors.sh
./migrate-selective-author.sh
./migrate-unified-author.sh
./migrate-main-branch-only.sh
./github-to-gitlab-demo.sh
# Fix script permissions
chmod +x git-migration-tool.sh install-global.sh
chmod +x examples/*.sh
# Check SSH key access
ssh -T [email protected]
ssh -T [email protected]
# Ensure URLs end with .git
β
https://github.com/user/repo.git
β https://github.com/user/repo
# Check URL accessibility
git ls-remote https://github.com/user/repo.git
# Reduce max file size limit
git-migration-tool --max-size "5M" ...
# Check repository size
du -sh .git/
# Manual installation
python3 -m pip install git-filter-repo
# Alternative installation
brew install git-filter-repo # macOS
sudo apt install git-filter-repo # Ubuntu
# Enable maximum verbosity
git-migration-tool --verbose --dry-run ...
# Check logs
tail -f ~/.git-migration-tool/logs/migration-*.log
- Check built-in help:
git-migration-tool --help
- Review examples:
cd examples/
and check scripts - Enable verbose mode: Add
--verbose
flag - Use dry-run: Test with
--dry-run
first - Check logs: Review log files in
logs/
directory
We welcome contributions! Here's how to get started:
# Fork and clone
git clone https://github.com/dev-kraken/git-migration-tool.git
cd git-migration-tool
# Install development dependencies
./install-global.sh
# Run tests
cd test/
chmod +x *.sh
./test-final-validation.sh
git-migration-tool/
βββ git-migration-tool.sh # Main executable
βββ install-global.sh # Installation script
βββ src/
β βββ git-migration-core.sh # Core functions
β βββ platform-detection.sh # Platform support
β βββ banner-utils.sh # UI utilities
βββ examples/ # Example scripts and configurations
βββ test/ # Test suite
βββ logs/ # Log files
βββ config/ # Configuration directory
βββ backups/ # Backup directory
βββ README.md # This file
-
Update
src/platform-detection.sh
:# Add platform detection detect_platform() { case "$url" in *newplatform.com*) echo "newplatform" ;; esac }
-
Add platform configuration:
get_platform_name() { case "$platform" in newplatform) echo "New Platform" ;; esac }
-
Test your changes:
cd test/ ./test-final-validation.sh
- Create feature branch:
git checkout -b feature/new-platform
- Make changes and test thoroughly
- Update documentation and examples
- Submit pull request with detailed description
This project is licensed under the MIT License - see the LICENSE file for details.
Dev Kraken
- π Website: https://devkraken.com
- π§ Email: [email protected]
- π GitHub: @dev-kraken
If you find this tool helpful, please:
- β Star the repository
- π Report issues on GitHub
- π‘ Suggest features via issues
- π€ Contribute improvements
π Happy Migrating! π
Created with β€οΈ by Dev Kraken