so I have this snippet that I want to use to filter out branches that doesn't have a certain prefix and that hasn't received any commits in over 3 months so that I can remove them from our remote later on.
for k in $(git branch -r | awk -Forigin !'/\/Prefix1\/|\/prefix2\//'); do
if [ "$(git log -1 --before="3 month" $k)" ]; then
echo "$(git log -1 --pretty=format:"%ci, %cr, " $k) $k";
fi;
done
The problem is currently that when I run this I see branches that have received commits 3 weeks ago, 5 months ago, 2 months ago, 1 month ago etc etc and I can't figure out why.
But if I only run: git log --before="4 month" --pretty=format:"%ci, %cr, " It works as intended.
Can anyone give me any guidance?