Push Guard is an intelligent VS Code extension that helps prevent you from losing your work by tracking code changes and reminding you to commit and push to Git. It monitors your coding progress, provides smart notifications, and integrates seamlessly with Git to keep your work secure.
- π Line Change Counter: Tracks lines modified across supported file types.
- β±οΈ Session Time Tracking: Monitors coding duration and milestone achievements.
- π Multi-File Support: Tracks changes in multiple files across your workspace.
- π― Configurable Milestone: Activates notifications after a customizable line threshold (default: 30 lines).
- π Productivity Stats: Shows lines changed, files modified, session time, and lines per minute.
- π Periodic Notifications: Reminds you at configurable intervals (default: 15 minutes) about uncommitted or unpushed changes.
- π‘οΈ Status Bar Updates: Displays lines changed in the status bar, clickable to view stats or commit.
- π¨ Close Protection: Warns you before closing VS Code if changes are pending (Alt+F4 or Cmd+Q).
- πΎ Save Protection: Checks for pending changes on file save, with configurable frequency to support auto-save.
- π Progress Insights: Includes session stats in all notifications for context.
- π Smart Commit Messages: Auto-generates commit messages based on lines and files changed.
- β Quick Push Option: Push existing commits without new commits.
- π Automatic Git Operations: Handles
git add,git commit, andgit pushseamlessly. - πΏ Branch Detection: Automatically pushes to the current branch.
- βοΈ Enable/Disable Commands: Toggle Push Guard per workspace.
- π Reset Counter: Reset tracking statistics to start fresh.
- π Show Stats Command: View detailed session statistics anytime.
- β Skip Options: Dismiss notifications when not ready to commit.
- π οΈ Configurable Settings: Customize line thresholds, notification intervals, and save checks.
- JavaScript/TypeScript:
.js,.ts,.jsx,.tsx - Python:
.py - Web Technologies:
.html,.css,.scss,.less,.vue,.svelte - Mobile/Native:
.swift,.kt,.java - Systems Programming:
.cpp,.c,.cs,.go,.rs - Other Languages:
.php,.rb
- Git: Must be installed and available in your system
PATH. - Git Repository: Workspace must be a Git repository with a valid remote (
origin) and current branch. - Supported Files: Tracks changes in supported file types (see list above).
Customize Push Guard via VS Code settings:
pushGuard.enabled: Enable/disable Push Guard for the workspace (default:true).pushGuard.linesThreshold: Number of lines changed to enable notifications (default:30).pushGuard.notificationInterval: Interval in minutes for periodic notifications (default:15).pushGuard.checkOnSave: Check for unpushed changes when saving files (default:true).pushGuard.checkOnSaveInterval: Minimum interval in minutes between save-triggered checks to prevent notification spam with auto-save (default:5).
Example settings.json:
{
"pushGuard.enabled": true,
"pushGuard.linesThreshold": 50,
"pushGuard.notificationInterval": 30,
"pushGuard.checkOnSave": true,
"pushGuard.checkOnSaveInterval": 5,
"files.autoSave": "afterDelay",
"files.autoSaveDelay": 1000
}- Open a Git repository in VS Code.
- Start coding in supported file types.
- Push Guard tracks line changes and updates the status bar.
- After reaching the line threshold (default: 30), notifications activate.
- Periodic reminders (default: every 15 minutes) check for uncommitted/unpushed changes.
- Save a file to trigger a check (if
pushGuard.checkOnSaveis enabled, limited bypushGuard.checkOnSaveInterval).
Access via Command Palette (Ctrl+Shift+P or Cmd+Shift+P):
- Push Guard: Enable: Enable Push Guard for the workspace.
- Push Guard: Disable: Disable Push Guard for the workspace.
- Push Guard: Reset Counter: Reset tracking statistics.
- Push Guard: Show Stats: View detailed session statistics.
- Push Guard: Commit and Push: Manually commit and push changes.
- Push Guard: Check Before Closing: Check for pending changes before closing VS Code.
When prompted about pending changes, choose:
- Commit & Push: Commit with a custom message and push.
- Just Push: Push existing commits.
- Show Stats: View detailed session stats.
- Skip This Time/Close Anyway: Dismiss the notification.
- Disable Push Guard: Turn off Push Guard for the workspace.
- Code Monitoring: Listens for changes in supported file types.
- Progress Tracking: Counts lines added/modified and files changed.
- Milestone Detection: Activates notifications after the line threshold.
- Periodic Checks: Checks Git status every minute, notifies based on configured interval.
- Save Protection: Checks on file save, debounced to avoid spam with auto-save.
- Close Protection: Warns on window close or file save if changes are pending.
- Smart Statistics: Provides productivity insights in notifications and stats.
- Limited to Git repositories; other SCM systems are not supported.
- Multi-root workspaces may trigger notifications for each Git repository.
- Line counting includes both additions and modifications.
- Close detection relies on
Alt+F4/Cmd+Qor file saves due to VS Code API limitations.
- Push errors: Ensure Git is installed, and the repository has a valid remote (
origin). Check error messages for details (e.g., "Permission denied" may indicate authentication issues). - Excessive notifications with auto-save: Set
pushGuard.checkOnSaveIntervalto a higher value (e.g., 10 minutes) or disablepushGuard.checkOnSave. - No notifications: Verify
pushGuard.enabledistrueand the workspace is a Git repository. - Intrusive notifications: Adjust
pushGuard.notificationIntervalor disablepushGuard.checkOnSavein settings.
Auto-Save Support and Enhancements
- β¨ NEW: Debounced save checks to support auto-save (
files.autoSave: afterDelay). - β¨ NEW:
pushGuard.checkOnSaveIntervalsetting to control save check frequency. - β¨ NEW: Notification suppression to avoid redundant prompts.
- π IMPROVED: Refined notification logic for better UX with frequent saves.
- π FIXED: Potential notification spam with auto-save enabled.
- β¨ NEW: Status bar for passive line change tracking.
- β¨ NEW: Configurable line threshold and notification interval.
- β¨ NEW: Enhanced statistics with lines per minute.
- β¨ NEW: File save checks and close protection.
- π IMPROVED: Error handling for Git commands with detailed messages.
- π IMPROVED: Pre-checks for commit/push to prevent unnecessary operations.
- π FIXED: Push errors due to misinterpretation of Git warnings.
- π FIXED: Unified command namespace to push-guard.
- Smart code change tracking and milestone notifications.
- Support for multiple programming languages.
- Auto-generated commit messages and progress stats.
- Initial release with basic Git status checking and push reminders.
Contributions are welcome! Fork the repository, make changes, and submit a pull request. Report issues or feature requests on GitHub.
MIT License. See LICENSE.
Iβm excited to share Push Guard on LinkedIn to showcase its features and gather feedback from the developer community. Try it out, share your thoughts, and help make it even better!
Code with confidence - Push Guard has your back! π‘οΈ
