A Git wrapper CLI tool for managing files scattered across your operating system. Track, synchronize, and version control configuration files, scripts, and other important files from their original locations while maintaining a centralized git repository.
- Cross-platform file tracking: Track files from anywhere on your filesystem
- Platform-aware synchronization: Automatically handles different file locations per platform (Linux, macOS, Windows)
- Automatic git commits: The
updatecommand creates detailed git commits with timestamps - Safe bidirectional sync: Modification date checks prevent accidental overwrites
- JSON configuration: Human-readable tracking configuration
git clone <repository-url>
cd sggit
cargo install --path .- Rust 1.75+ (for compatibility with older systems)
- Git (for repository operations)
-
Initialize a new sggit repository:
mkdir my-configs cd my-configs sggit init -
Add files to track:
sggit add ~/.bashrc sggit add ~/.vimrc sggit add /etc/nginx/nginx.conf
-
Update from remote locations:
sggit update
-
Sync changes back to remote locations:
sggit sync
Creates an empty git repository and initializes sggit configuration.
sggit initAdds a file to be tracked by sggit. The file must exist at the specified path.
sggit add ~/.bashrc
sggit add /home/user/scripts/backup.shWhat it does:
- Records the file's remote location and current platform
- Stores metadata in
.sggit/config.json - Creates a local filename based on the original filename
Copies files from their remote locations to the local sggit repository and commits the changes.
sggit updateWhat it does:
- Copies tracked files from remote locations to local repository
- Creates a git commit with detailed information:
- Number of files updated
- List of files with their last modified timestamps
- Only processes files that match the current platform
Example commit message:
Update 2 files from remote locations
- bashrc (modified: 2025-01-05 14:30:25 UTC)
- vimrc (modified: 2025-01-05 14:28:10 UTC)
Updates remote files with changes from the local repository.
sggit syncWhat it does:
- Copies files from local repository back to their remote locations
- Checks modification dates to prevent overwriting newer remote files
- Only syncs files where local version is newer than remote version
- Updates last sync timestamp in configuration
Sggit stores its configuration in .sggit/config.json. This file tracks all managed files and their metadata.
{
"files": {
"bashrc": [
{
"remote_path": "/home/user/.bashrc",
"platform": "linux",
"local_path": "bashrc",
"last_synced": "2025-01-05T14:30:25.123456789Z"
}
],
"config.ini": [
{
"remote_path": "/home/user/.config/app/config.ini",
"platform": "linux",
"local_path": "config.ini",
"last_synced": null
},
{
"remote_path": "C:\\Users\\user\\AppData\\app\\config.ini",
"platform": "windows",
"local_path": "config.ini",
"last_synced": null
}
]
}
}Sggit automatically detects the current platform and only processes files that match:
linux- Linux systemsmacos- macOS systemswindows- Windows systems
This allows you to track the same logical file across different platforms with different paths.
# Track shell configurations
sggit add ~/.bashrc
sggit add ~/.zshrc
sggit add ~/.tmux.conf
# Track application configs
sggit add ~/.config/nvim/init.vim
sggit add ~/.gitconfig# Track server configurations
sggit add /etc/nginx/nginx.conf
sggit add /etc/systemd/system/myapp.service
sggit add /etc/crontab# Track IDE settings
sggit add ~/.vscode/settings.json
sggit add ~/.vscode/keybindings.json
# Track development tools
sggit add ~/.tool-versions
sggit add ~/.env.example-
Set up tracking:
mkdir ~/dotfiles cd ~/dotfiles sggit init sggit add ~/.bashrc sggit add ~/.vimrc
-
Capture current state:
sggit update git log --oneline # See the commit with timestamps -
Edit files locally:
# Edit the local copies vim bashrc vim vimrc # Commit your changes git add . git commit -m "Update shell aliases and vim plugins"
-
Deploy changes:
sggit sync # Updates the actual files in their original locations -
Regular synchronization:
# Pull in external changes sggit update # Push local changes sggit sync
- Modification date checking:
synconly overwrites remote files if local files are newer - Platform isolation: Only processes files that match the current operating system
- Git integration: Full version history of all file changes
- Non-destructive operations: Files are copied, never moved
Run the test suite:
cargo testThe tests use temporary directories to simulate file operations without affecting your actual filesystem.
- Fork the repository
- Create a feature branch
- Add tests for new functionality
- Ensure all tests pass
- Submit a pull request
[Add your license here]
Make sure the file path exists and is accessible:
ls -la /path/to/fileEnsure you're in a sggit repository:
ls -la .sggit/Check file permissions and ensure sggit has access to both source and destination paths:
chmod +r /source/file
chmod +w /destination/directory