A powerful Go-based command-line tool to manage your GitHub following relationships. Follow users who follow a specific user but don't follow you, or unfollow users who don't follow you back.
- π Follow Management: Follow followers of a specific user who don't follow you back
- ποΈ Unfollow Cleanup: Unfollow users who don't follow you back
- β‘ Efficient Processing: Handle large numbers of followers/following with pagination
- π‘οΈ Safe Execution: Interactive confirmation before bulk operations
- π Concurrent Processing: Configurable worker pool for fast execution
- π Secure Authentication: OAuth2 token-based GitHub API authentication
- βοΈ Flexible Configuration: Environment variables and command-line flags
- β±οΈ Rate Limiting: Configurable delays to respect GitHub API limits
- Go 1.24 or higher
- A GitHub account
- A GitHub Personal Access Token with the
user:followscope
-
Clone the repository:
git clone https://github.com/dbunt1tled/github-unfollow.git cd github-unfollow -
Install dependencies:
go mod download
-
Build the application:
go build -o github-followers ./main.go
go install github.com/dbunt1tled/github-unfollow@latest- Go to GitHub Settings β Developer settings β Personal access tokens β Tokens (classic)
- Generate a new token with the
user:followscope - Copy the token for configuration
Create a .env file in the project root or set environment variables:
# Required
GITHUB_USERNAME=your_github_username
GITHUB_TOKEN=your_github_personal_access_token
# Optional (with defaults)
WORKER_COUNT=1 # Number of concurrent workers (default: 1)
QUEUE_SIZE=3 # Size of the worker queue (default: 3)
TIME_DELAY_MS=2000 # Delay between API calls in milliseconds (default: 2000)Note: You can copy
.env.exampleto.envand fill in your credentials.
The tool provides two main commands: follow and unfollow.
Follow followers of a specific user who don't already follow you:
# Basic usage - follow followers of 'username' who don't follow you
./github-followers follow username
# Skip confirmation prompt
./github-followers follow username --force
./github-followers follow username -fUnfollow users who don't follow you back:
# Show users who don't follow you back (dry run)
./github-followers unfollow
# Actually unfollow users who don't follow you back without confirm
./github-followers unfollow --f
./github-followers unfollow --forcegithub-unfollow/
βββ cmd/ # Main application entry point
βββ internal/
β βββ cli/ # Command-line interface implementation
β βββ config/ # Configuration management
β βββ git_hub_manager/# GitHub API client and operations
β βββ helper/ # Utility and helper functions
β βββ worker/ # Worker pool implementation
βββ .env.example # Example environment variables
βββ .gitignore # Git ignore file
βββ go.mod # Go module definition
βββ go.sum # Go module checksums
βββ main.go # Application entry point
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Unfollow users who don't follow you back:
# Basic usage - unfollow users who don't follow you back
./github-unfollow unfollow
# Skip confirmation prompt
./github-unfollow unfollow --force
./github-unfollow unfollow -fExample workflow:
- Tool fetches your followers list
- Tool fetches your following list
- Identifies users you follow who don't follow you back
- Shows the list and asks for confirmation (unless
--forceis used) - Unfollows the users concurrently with rate limiting
Both commands support the following flags:
--force, -f: Skip interactive confirmation prompt (use with caution)--help, -h: Show help information
# Show general help
./github-unfollow --help
# Show help for specific commands
./github-unfollow follow --help
./github-unfollow unfollow --help-
WORKER_COUNT: Number of concurrent workers for API calls (default: 1)
- Higher values = faster execution but more API rate limit pressure
- Recommended: 1-5 for most use cases
-
QUEUE_SIZE: Size of the task queue (default: 3)
- Buffer size for pending tasks
- Should be >= WORKER_COUNT
-
TIME_DELAY_MS: Delay between API calls in milliseconds (default: 2000)
- Helps avoid GitHub API rate limits
- Lower values = faster execution but higher risk of rate limiting
- Recommended: 1000-3000ms
Conservative (safe for large operations):
WORKER_COUNT=1
QUEUE_SIZE=3
TIME_DELAY_MS=3000Balanced:
WORKER_COUNT=2
QUEUE_SIZE=3
TIME_DELAY_MS=2000# Set token and username via environment
export GITHUB_USERNAME="myusername"
export GITHUB_TOKEN="ghp_xxxxxxxxxxxxxxxxxxxx"
export WORKER_COUNT=2
export TIME_DELAY_MS=1500
./github-unfollow unfollowThe project is organized into the following components:
main.go: Application entry pointcmd/: Cobra CLI commandsroot.go: Root command setupfollow.go: Follow command implementationunfollow.go: Unfollow command implementation
internal/: Internal packagesconfig/: Configuration management with Vipergit_hub_manager/: GitHub API client wrapperworker/: Worker pool for concurrent processinghelper/: Utility functions
- Your GitHub token is only used to authenticate with the GitHub API
- The token requires only the
user:followscope - no access to repositories or other data - Tokens are loaded from environment variables, never hardcoded
- Never share your
.envfile or commit it to version control - The
.envfile is included in.gitignoreby default
GitHub API has rate limits:
- 5,000 requests per hour for authenticated requests
- Each follow/unfollow operation uses 1 API call
- The tool includes built-in delays (configurable via
TIME_DELAY_MS) - Use conservative settings for large operations
"Authentication failed" error:
- Verify your
GITHUB_TOKENis correct and hasuser:followscope - Check that the token hasn't expired
"Rate limit exceeded" error:
- Increase
TIME_DELAY_MSvalue - Reduce
WORKER_COUNT - Wait for the rate limit to reset (1 hour)
"User not found" error:
- Verify the username exists and is public
- Some users may have restricted follower lists
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
This tool is provided as-is, without any warranties. Use it at your own risk. The maintainers are not responsible for any issues caused by using this tool. Always review the list of users before confirming bulk operations.
If you find this tool useful, please consider giving it a β on GitHub!