|
| 1 | +# Git Guardian |
| 2 | + |
| 3 | +**Git Guardian** is a simple yet powerful CLI tool to automatically back up your project folders to GitHub. Designed for Mac users, Guardian watches your directories for changes or backs them up on a regular interval, committing and pushing changes automatically. It’s perfect for developers who want effortless version control without thinking about it. |
| 4 | + |
| 5 | +The CLI tool is called `guardian`. |
| 6 | + |
| 7 | +--- |
| 8 | + |
| 9 | +## 🚀 Core Features |
| 10 | + |
| 11 | +* **Auto-Backup:** Automatically commit and push changes to a GitHub repository. |
| 12 | +* **Watch Mode:** Monitor a folder for file changes and push updates with a configurable debounce time (e.g., every 30 seconds). |
| 13 | +* **Interval Mode:** Push all changes at a set interval (e.g., every 5 minutes). |
| 14 | +* **Folder Management:** Link folders to Guardian and manage them easily. |
| 15 | +* **Listeners Dashboard:** View all active watchers, pause, resume, or remove them. |
| 16 | +* **Autostart:** Guardian can start automatically when your Mac boots. |
| 17 | +* **Safe and Reliable:** Stops watchers if a folder is deleted and prevents duplicate or conflicting commits. |
| 18 | + |
| 19 | +--- |
| 20 | + |
| 21 | +## 💻 Installation |
| 22 | + |
| 23 | +### From Source |
| 24 | + |
| 25 | +1. Clone the repository: |
| 26 | + |
| 27 | +```bash |
| 28 | +git clone https://github.com/itzcodex24/git-guardian.git |
| 29 | +cd git-guardian |
| 30 | +``` |
| 31 | + |
| 32 | +2. Build the CLI tool: |
| 33 | + |
| 34 | +```bash |
| 35 | +go build -o guardian ./... |
| 36 | +``` |
| 37 | + |
| 38 | +3. Move it to your `PATH` for global access: |
| 39 | + |
| 40 | +```bash |
| 41 | +sudo mv guardian /usr/local/bin/ |
| 42 | +``` |
| 43 | + |
| 44 | +### Homebrew (Recommended for users) |
| 45 | + |
| 46 | +Once the Homebrew formula is published: |
| 47 | + |
| 48 | +```bash |
| 49 | +brew install itzcodex24/git-guardian/guardian |
| 50 | +``` |
| 51 | + |
| 52 | +--- |
| 53 | + |
| 54 | +## ⚡ Usage |
| 55 | + |
| 56 | +### Initialize Guardian in a folder: |
| 57 | + |
| 58 | +```bash |
| 59 | +guardian init |
| 60 | +``` |
| 61 | + |
| 62 | +### Link a folder to Guardian: |
| 63 | + |
| 64 | +```bash |
| 65 | +guardian link ~/Projects/myproject |
| 66 | +``` |
| 67 | + |
| 68 | +### Start automatic backup: |
| 69 | + |
| 70 | +* **Watch mode (on change):** |
| 71 | + |
| 72 | +```bash |
| 73 | +guardian start ~/Projects/myproject --watch --debounce 30s |
| 74 | +``` |
| 75 | + |
| 76 | +* **Interval mode (every 5 minutes):** |
| 77 | + |
| 78 | +```bash |
| 79 | +guardian start ~/Projects/myproject --interval 5m |
| 80 | +``` |
| 81 | + |
| 82 | +### Manage watchers: |
| 83 | + |
| 84 | +```bash |
| 85 | +guardian listeners # List active watchers |
| 86 | +guardian pause <id> # Pause a watcher |
| 87 | +guardian resume <id> # Resume a watcher |
| 88 | +guardian remove <id> # Remove a watcher |
| 89 | +``` |
| 90 | + |
| 91 | +### Autostart Guardian on Mac login: |
| 92 | + |
| 93 | +```bash |
| 94 | +guardian autostart enable |
| 95 | +guardian autostart disable |
| 96 | +``` |
| 97 | + |
| 98 | +--- |
| 99 | + |
| 100 | +## 📝 Collaboration Guidelines |
| 101 | + |
| 102 | +Git Guardian is open source! Your feedback, bug reports, and contributions are highly appreciated. Let’s make automatic Git backups easier for everyone! |
| 103 | + |
| 104 | +We welcome contributions! Here’s how you can collaborate: |
| 105 | + |
| 106 | +1. **Fork the repository** and create a feature branch: |
| 107 | + |
| 108 | +```bash |
| 109 | +git checkout -b feature/my-awesome-feature |
| 110 | +``` |
| 111 | + |
| 112 | +2. **Write code and tests** for your feature. |
| 113 | +3. **Commit changes** with clear messages: |
| 114 | + |
| 115 | +```bash |
| 116 | +git commit -m "Add feature X with Y improvements" |
| 117 | +``` |
| 118 | + |
| 119 | +4. **Push to your fork** and open a pull request. |
| 120 | +5. **Code review:** PRs will be reviewed, and feedback may be requested before merging. |
| 121 | +6. **Issues:** Report bugs or suggest features via GitHub Issues. |
| 122 | + |
| 123 | +**Code Style:** |
| 124 | + |
| 125 | +* Follow Go conventions (`gofmt`, `golint`) |
| 126 | +* Keep commits focused and atomic |
| 127 | +* Document public functions and methods clearly |
| 128 | + |
0 commit comments