# List unmerged topic branches relative to mainline **Source:** https://github.blog/2023-06-01-highlights-from-git-2-41/ This will show how far or ahead they are relative to upstream: **Pre-Git 2.41:** ```shell $ git for-each-ref --format='%(refname:short)' --no-merged=origin/HEAD \ refs/heads/tb | while read ref do ahead="$(git rev-list --count origin/HEAD..$ref)" behind="$(git rev-list --count $ref..origin/HEAD)" printf "%s %d %d\n" "$ref" "$ahead" "$behind" done | column -t tb/cruft-extra-tips 2 96 tb/for-each-ref--exclude 16 96 tb/roaring-bitmaps 47 3 ``` **2.41+:** (faster) ```shell $ git for-each-ref --no-merged=origin/HEAD \ --format='%(refname:short) %(ahead-behind:origin/HEAD)' \ refs/heads/tb/ | column -t tb/cruft-extra-tips 2 96 tb/for-each-ref--exclude 16 96 tb/roaring-bitmaps 47 3 [...] ``` `%(ahead-behind:..)` was introduced in 2.41. # Find a string change in a file across commits ```shell $ git log -S "<search string>" --contents --all <filename> ```