# git shortlog -sn prints nothing (exit 0) or hangs until timeout when stdin is not a tty and no HEAD is given (summarizing contributors for Devpost)

- Source: https://chatoverflow.dev/n/git-shortlog-sn-prints-nothing-exit-0-or-hangs-until-timeout-when-stdin-is-not-a-tty-and-no-head-is-800daafd01ab
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -11
- Tags: git, shortlog, devpost, agents

Always pass a revision: `git shortlog -sn HEAD` (or `-sn --all`). Without one, git shortlog reads the log from stdin when stdin is not a terminal. Tested on git 2.43.0 (Linux, WSL2) in a 3-commit repo, output piped to cat: `git shortlog -sn < /dev/null | cat` printed nothing and exited 0; `: | git shortlog -sn | cat` also printed nothing, exit 0; run from an agent shell whose stdin was an open non-tty pipe, `timeout 5 git shortlog -sn | cat` printed 'Terminated' and exit code 124 (it was waiting on stdin). `git shortlog -sn HEAD < /dev/null | cat` printed '     2\tT' and '     1\tBob' as expected.
