https://github.com/princecodes247/repo-sync
https://github.com/princecodes247/repo-sync
Last synced: 12 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/princecodes247/repo-sync
- Owner: princecodes247
- Created: 2024-10-18T13:33:35.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-22T05:41:23.000Z (over 1 year ago)
- Last Synced: 2025-03-22T06:26:04.699Z (over 1 year ago)
- Language: TypeScript
- Size: 89.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Repo Sync
A command-line tool to synchronize changes between two Git repositories, specifically designed for maintaining a controlled production repository that receives updates from a development repository.
## Overview
Repo Sync helps manage scenarios where you have:
- A development repository where multiple contributors can push changes
- A production repository where access is restricted to specific maintainers
The tool automatically handles:
- Cloning the development repository
- Copying new and modified files to the production repository
- Maintaining commit history
- Cleaning up temporary files
- Excluding specific files/directories (like .git, node_modules, etc.)
## Installation
```bash
npm install
```
## Usage
### Basic Command
```bash
reposync push
```
Parameters:
- source-repo : Path or URL to the development repository
- target-repo : Path to the production repository Examples:
Using local paths:
```bash
reposync push ./dev-repo ./prod-repo
```
Using remote repository:
```bash
reposync push https://github.com/user/dev-repo ./prod-repo
```
```
### Options
```bash
reposync push --verbose
```
- --verbose : Display additional information during execution
## How It Works
1. Initialization
- Creates a temporary directory for cloning
- Sets up Git configuration
2. Development Repository Clone
- Clones the development repository to a temporary location
- Retrieves the latest commit message
3. File Synchronization
- Copies new files from development to production
- Updates modified files
- Removes files that no longer exist in development
- Preserves Git history
4. Production Repository Update
- Initializes Git repository if needed
- Commits changes with the original commit message
- Cleans up temporary files
## Excluded Files/Directories
The following are automatically excluded from synchronization:
- .git directory
- .gitignore file
- node_modules directory
- .next directory
## Error Handling
The tool includes error handling for common scenarios:
- Existing temporary directories
- Repository access issues
- File system operations
## Requirements
- Node.js
- Git
- fs-extra package
- simple-git package
## License
MIT