Personal Git configuration and utilities for cross-machine synchronization.
Current Version: v0.1.0-pre | Changelog
.gitconfig.template- Template for generating machine-specific Git configuration.gitignore_global- Global gitignore patterns for IDEs, OS files, and development toolsgitconfig_helper.py- Python utility for managing git aliases, branch cleanup, and main branch operationsscripts/- PowerShell automation scriptsSetup-GitConfig.ps1- Unified setup wrapper script (creates symlinks, generates config, sets up scheduled task)Initialize-GitConfig.ps1- Generates.gitconfigfrom template with machine-specific pathsInitialize-LocalConfig.ps1- Generates.gitconfig.localwith SSH signing and safe directoriesInitialize-Symlinks.ps1- Creates symbolic links for.gitignore_globaland helper scriptsUpdate-GitConfig.ps1- Automated daily git pull script (runs at login)Cleanup-GitConfig.ps1- Uninstall and reset utility
docs/- Documentation and knowledge graphknowledge-graph.jsonl- Entity and relation data for project documentation
git alias- List all configured git aliases in a formatted tablegit branches- Download all remote branches and create local tracking branchesgit cleanup- Delete local branches that no longer have remote trackinggit main- Switch to main branch with full error handling- Fetches updates from remote (with pruning)
- Checks for uncommitted changes (prevents data loss)
- Switches to main branch
- Pulls latest changes (main is now fully updated)
- Cleans up branches with deleted remotes (automatic merged branch cleanup)
- Detects and reports merge conflicts
- SSH-based commit signing with OpenSSH key format
- Auto-setup remote tracking for pushed branches
- Custom editor (VS Code with
--waitflag) - Safe directories configured for shared network locations
- Python 3.7+ (for gitconfig_helper.py)
- rich library: Install with
python -m pip install rich - PowerShell 5.1+ (for setup script)
- Administrator privileges (recommended for creating symlinks on Windows)
-
Clone this repository:
git clone https://github.com/J-MaFf/gitconfig.git ~/Documents/Scripts/gitconfig
-
Run the unified setup script with administrator privileges:
cd ~/Documents/Scripts/gitconfig .\scripts\Setup-GitConfig.ps1 -Force
This single command will:
- Generate
~/.gitconfigfrom the template with machine-specific paths - Create symlinks for
.gitignore_globalandgitconfig_helper.py - Generate
~/.gitconfig.localwith SSH signing configuration - Set up a scheduled task for automatic updates at login
- Generate
-
Install the Python dependency:
python -m pip install rich
If you prefer to run setup steps individually:
$repo = "$env:USERPROFILE\Documents\Scripts\gitconfig"
# Generate .gitconfig from template
.\scripts\Initialize-GitConfig.ps1 -Force
# Create symlinks
.\scripts\Initialize-Symlinks.ps1 -Force
# Generate machine-specific configuration
.\scripts\Initialize-LocalConfig.ps1 -Force# Unified setup (recommended) - runs all setup steps
.\scripts\Setup-GitConfig.ps1 -Force
# Without scheduled task creation
.\scripts\Setup-GitConfig.ps1 -Force -NoTask
# Generate .gitconfig from template
.\scripts\Initialize-GitConfig.ps1 -Force
# Initialize symlinks (requires admin privileges)
.\scripts\Initialize-Symlinks.ps1 -Force
# Initialize local machine-specific configuration
.\scripts\Initialize-LocalConfig.ps1 -Force
# Display help for any script
.\scripts\Initialize-Symlinks.ps1 -Help
.\scripts\Initialize-LocalConfig.ps1 -HelpAfter installation, use the configured aliases:
git alias # Show all aliases
git branches # Track all remote branches
git cleanup # Clean up local branches
git main # Switch to main with automatic updatesThe configuration uses a template-based generation approach for maximum portability:
- Contains placeholders:
{{REPO_PATH}}and{{HOME_DIR}} - Version controlled for consistency across machines
- User information, aliases, and common settings
- Generated from template by
Initialize-GitConfig.ps1 - Placeholders replaced with machine-specific absolute paths
- NOT tracked in Git (excluded in
.gitignore) - Each machine generates its own version
- SSH signing configuration and safe directories
- Created by
Initialize-LocalConfig.ps1 - NOT tracked in Git (excluded in
.gitignore) - Each machine has its own version
This template-based approach ensures:
- ✅ No hardcoded paths in version control
- ✅ Complete portability across different machines and users
- ✅ Easy customization by editing the template
- ✅ Consistent configuration through version-controlled template
The generated ~/.gitconfig includes ~/.gitconfig.local for machine-specific settings:
[include]
path = ~/.gitconfig.localThe template uses placeholders that are replaced during generation:
{{REPO_PATH}}→ Absolute path to the gitconfig repository{{HOME_DIR}}→ User's home directory path
To regenerate after template changes:
.\scripts\Initialize-GitConfig.ps1 -ForceThis is a Git best practice for handling environment-specific configurations.
The .gitignore_global file is symlinked to ~/.gitignore_global and automatically configured in .gitconfig.local. It contains patterns for:
- IDE and Editor Files - VS Code, JetBrains, Sublime, Vim, Emacs, Atom
- OS-Specific Files - macOS (.DS_Store), Windows (Thumbs.db), Linux (.directory)
- Language-Specific Artifacts:
- Python:
__pycache__,*.pyc,.venv,venv/ - Node.js:
node_modules/,npm-debug.log - Go, Java, Ruby, C/C++, and more
- Python:
- Build Outputs -
build/,dist/,target/, compiled objects - Local Configuration Files -
.env,.secrets, credentials, private keys - Temporary Files -
.tmp,.cache,.bak, swap files
These patterns prevent common development artifacts from being accidentally committed to repositories.
The .gitconfig is configured for SSH-based commit signing using:
- OpenSSH key format (ed25519)
- 1Password SSH agent (
op-ssh-sign.exe) - Auto-signing on all commits
Update the signingkey and gpg.ssh.program values if using a different key or agent.
Network locations and local directories are configured as safe git directories to avoid permission issues:
\\10.210.3.10\dept\IT\PC Setup\winget-app-setupC:\Users\<username>\Documents\Scripts\winget-app-setupC:\Users\<username>\Documents\Scripts\winget-install\\10.210.3.10\dept\IT\Programs\Office\OfficeConfigs\\KFWS9BDC01\DEPT\IT\Programs\Office\OfficeConfigs
Modify these paths as needed for your environment.
- Windows 10/11: Run PowerShell as Administrator
- Older Windows: You may need to enable developer mode or use
mklinkcommand
python -m pip install --upgrade pip
python -m pip install richVerify the symlink is created:
ls $PROFILE # Should show .gitconfig symlinkTest the alias:
git aliasTo pull the latest configuration changes:
cd ~/.dotfiles
git pullChanges are immediately reflected in ~/.gitconfig and ~/.gitconfig_helper.py through symlinks.
This project follows Semantic Versioning (semver.org).
- Format:
vMAJOR.MINOR.PATCH[-PRERELEASE] - Current Status: Pre-release (
v0.1.0-pre) - See CHANGELOG.md for detailed version history and changes
The project is in initial development (0.x.y pre-release phase). Versions will progress as:
v0.1.0-alpha→v0.1.0-beta→v0.1.0-rc.1→v0.1.0(stable)
Once stable v1.0.0 is released, semantic versioning will strictly follow:
- MAJOR - Breaking changes
- MINOR - New backward-compatible features
- PATCH - Bug fixes
Personal configuration repository.