Here is a quick GitHub CLI trick to easily find users who don't follow you back (unfollowers). It fetches your following and followers lists via the GitHub API, compares them, and outputs the names of those who haven't followed.
First Authenticate in github cli using
gh auth refresh -h github.com -s user
Then ,
💻 macOS / Linux:
ME=$(gh api user -q .login); comm -13 <(gh api --paginate "users/$ME/followers" -q '.[].login' | sort) <(gh api --paginate "users/$ME/following" -q '.[].login' | sort) | while read u; do gh api -X DELETE "user/following/$u" && echo "unfollowed $u"; done
🪟 Windows (PowerShell):
$me = gh api user -q .login
$followers = gh api --paginate "users/$me/followers" -q '.[].login'
$following = gh api --paginate "users/$me/following" -q '.[].login'
$following | Where-Object { $_ -notin $followers } | ForEach-Object {
gh api -X DELETE "user/following/$_"
Write-Host "unfollowed $_"
}
Top comments (0)