DEV Community

Adhishatanaka
Adhishatanaka

Posted on

How to Find users who don't follow you back in Github

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 returned the favor. Combining CLI tools with APIs for small automations like this is a great way to cut down on repetitive tasks! 😎

💻 macOS / Linux:

comm -23 \
<(gh api user/following --jq '.[].login' | sort) \
<(gh api user/followers --jq '.[].login' | sort)

Enter fullscreen mode Exit fullscreen mode

🪟 Windows (PowerShell):

$following = gh api user/following --jq '.[].login' | Sort-Object
$followers = gh api user/followers --jq '.[].login' | Sort-Object

Compare-Object $following $followers | Where-Object {$_.SideIndicator -eq "<="}
Enter fullscreen mode Exit fullscreen mode

Top comments (0)