GitFollow
GitFollow is a powerful CLI tool to track your GitHub followers and unfollows with ease. Get notified when someone follows or unfollows you, generate detailed reports, and automate your follower monitoring with GitHub Actions.
Features
Core Features
- π Track new followers in real-time
- Detect unfollows automatically
- Generate detailed statistics and reports
- Maintain complete history with timestamps
- Create GitHub Issues automatically on changes
- Local JSON-based storage
Beautiful Output
- Colorized terminal output
- Formatted tables (TTY::Table)
- Progress spinners
- Markdown and plain text reports
Developer-Friendly
- JSON export support
- CSV export for data analysis
- Configurable data directory
- Rate limit aware
- Comprehensive error handling
Installation
Via RubyGems (Recommended)
gem install gitfollow
From Source
git clone https://github.com/bulletdev/gitfollow.git
cd gitfollow
bundle install
gem build gitfollow.gemspec
gem install ./gitfollow-0.1.0.gem
Configuration
GitHub Token
GitFollow requires a GitHub Personal Access Token with appropriate permissions.
- Generate a token: Go to GitHub Settings β Developer settings β Personal access tokens
-
Required scopes:
read:user
(to read your follower data) - Set the token:
export OCTOCAT_TOKEN="your_github_token_here"
Or create a .env
file:
OCTOCAT_TOKEN=your_github_token_here
Usage
Initialize GitFollow
First, initialize GitFollow to create your first snapshot:
gitfollow init
Output:
β Fetching initial data... Done!
Initialization complete!
Username: @yourname
Followers: 542
Following: 123
Mutual: 89
Run 'gitfollow check' to detect changes.
Check for Changes
Check for new followers or unfollows:
gitfollow check
Output:
β Checking for changes... Done!
Changes detected for @yourname
β
New Followers (2):
β’ @newuser1
β’ @newuser2
β Unfollowed (1):
β’ @olduser
Net change: +1
Previous: 542 β Current: 543
Display Statistics
View your current follower statistics:
gitfollow stats
Output:
Follower Statistics for @yourname
==================================================
ββββββββββββββββββββββββ¬ββββββ
βFollowers β543 β
βFollowing β123 β
βMutual β89 β
βRatio β4.41 β
βTotal New Followers β15 β
βTotal Unfollows β3 β
ββββββββββββββββββββββββ΄ββββββ
Last Updated: 2025-10-07 09:00:00 UTC
Generate Reports
Generate a detailed report:
# Plain text report
gitfollow report
# Markdown report
gitfollow report --format=markdown
# Save to file
gitfollow report --format=markdown --output=report.md
Find Mutual Followers
List users who follow you and whom you follow back:
gitfollow mutual
Find Non-Followers
List users you follow who don't follow you back:
gitfollow non-followers
Export Data
Export your data for analysis:
# Export to JSON
gitfollow export json data.json
# Export to CSV
gitfollow export csv data.csv
Advanced Usage
JSON Output
All commands support JSON output:
gitfollow check --json
gitfollow stats --json
gitfollow mutual --json
Table Format
Display changes in a formatted table:
gitfollow check --table
Quiet Mode
Suppress output if no changes detected:
gitfollow check --quiet
Custom Data Directory
Store data in a custom location:
gitfollow check --data-dir=/path/to/data
Create GitHub Issues on Changes
Automatically create an issue when changes are detected:
gitfollow check --notify="bulletdev/gitfollow"
Automated Monitoring with GitHub Actions
Set up automated daily checks using GitHub Actions:
1. Create Workflow File
Create .github/workflows/daily-check.yml
:
name: Daily Follower Check
on:
schedule:
- cron: '0 9 * * *' # Run daily at 9 AM UTC
workflow_dispatch:
jobs:
check-followers:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
- name: Install GitFollow
run: gem install gitfollow
- name: Cache data
uses: actions/cache@v4
with:
path: ~/.gitfollow
key: gitfollow-data
- name: Check followers
env:
OCTOCAT_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gitfollow init || true
gitfollow check --notify="${{ github.repository }}"
2. Enable Workflow
- Push the workflow file to your repository
- Go to Actions tab in your repository
- Enable the workflow
- It will run automatically every day!
CLI Commands Reference
Command | Description |
---|---|
gitfollow init |
Initialize and create first snapshot |
gitfollow check |
Check for follower changes |
gitfollow report |
Generate detailed report |
gitfollow stats |
Display statistics |
gitfollow mutual |
List mutual followers |
gitfollow non-followers |
List non-followers |
gitfollow export FORMAT FILE |
Export data (json/csv) |
gitfollow clear |
Clear all stored data |
gitfollow version |
Display version |
Configuration File
You can create a .gitfollow.yml
config file (optional):
# Custom data directory
data_dir: ~/.gitfollow
# Default notification repository
notify_repo: bulletdev/gitfollow
# Output preferences
output:
colorize: true
format: table
Data Storage
GitFollow stores data in ~/.gitfollow/
by default:
~/.gitfollow/
βββ snapshots.json # Follower snapshots
βββ history.json # Change history
Development
Setup
git clone https://github.com/bulletdev/gitfollow.git
cd gitfollow
bundle install
Run Tests
bundle exec rspec
Lint Code
bundle exec rubocop
Build Gem
gem build gitfollow.gemspec
Contributing
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
Please ensure:
- All tests pass (
bundle exec rspec
) - Code follows style guide (
bundle exec rubocop
) - Add tests for new features
- Update documentation as needed
Publishing to RubyGems
Manual Publication
# Build the gem
gem build gitfollow.gemspec
# Push to RubyGems
gem push gitfollow-0.1.0.gem
Automated Release
- Update version in
lib/gitfollow/version.rb
- Update
CHANGELOG.md
- Commit changes
- Create and push a tag:
git tag v0.1.0
git push origin v0.1.0
The GitHub Actions workflow will automatically build and publish to RubyGems.
Troubleshooting
Authentication Failed
Error: Authentication failed while fetching followers
Solution: Ensure your GitHub token is valid and has the required read:user
scope.
Rate Limit Exceeded
Error: Rate limit exceeded
Solution: GitHub API has rate limits. Wait for the limit to reset or reduce check frequency.
No Changes Detected on First Run
This is expected! Run gitfollow init
first to create your initial snapshot.
Security
- Never commit your GitHub token to version control
- Use GitHub Secrets for CI/CD workflows
- The
.env
file should be in.gitignore
- Tokens are never logged or stored in data files
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- Built with Octokit for GitHub API
- Uses Thor for CLI framework
- Formatted output with TTY::Table
Support
- π Report a bug
- π‘ Request a feature
- π Documentation
Made with πβ¦οΈ by Michael D. Bullet
β Star this repo if you find it useful!