3 ms·
Not sure why all the lines of code. This is much shorter: git ls-files|xargs -n 1 git blame --date=format:%Y%m%d -f |grep -Eo '\d{8}.*' |sort -r | head -n
by JensRantil 2y ago
Not sure why all the lines of code. This is much shorter:
git ls-files|xargs -n 1 git blame --date=format:%Y%m%d -f |grep -Eo '\d{8}.*' |sort -r | head -n 1 | sed 's/^[^)]*) \t//'
(on MacOSX)
- pc86 2y agoFormatting strikes again
- JensRantil 2y agoThanks. Fixed.
- js2 2y agoGet in the habit of using `ls-files -0` and `xargs -0` to prevent surprises. But there's no need to blame every file: https://news.ycombinator.com/item?id=42883340 https://news.ycombinator.com/item?id=42883340
- JensRantil 2y agoGood point. I fixed your null comment in https://news.ycombinator.com/item?id=42885601 https://news.ycombinator.com/item?id=42885601.
- jamesfinlayson 2y agoHm, tried this on a Mac but something must be askew - it returned a commit by me in 2022 in a repo that has existed since at least 2017.
- JensRantil 2y agoWhoops, it extracted the newest row :) Correction: git ls-files -z|xargs -0 -n 1 git blame --date=format:%Y%m%d -f |grep -Eo '\d{8}.*' |sort -n | head -n 1 | sed 's/^[^)]*)*[ \t]//' This also use a null delimiter for the files and fixes a small sed pattern bug.