-git tag "next-$d"
-git update-ref refs/heads/stable refs/remotes/origin/master
-
-# Stitch the new tree into the history branch
-new_ref=$(echo "next-$d" | git commit-tree 'HEAD^{tree}' -p history -p HEAD)
-git update-ref -m "next-$d" refs/heads/history $new_ref
-
-# Create a patch to remove the localversion-next file
-cat >../nolocalversion-$d.patch <<EOF
-diff --git a/localversion-next b/localversion-next
-deleted file mode 100644
-index d795256..0000000
---- a/localversion-next
-+++ /dev/null
-@@ -1 +0,0 @@
---next-$d
-EOF
+git tag -u $gpg_key -m "$n" "$n"
+
+git branch -f stable refs/remotes/origin/master
+
+p="patch-$l-$n"
+git diff-tree -p "$l.." >"../$p"
+gpg -u $kup_gpg_key -a -b "../$p"
+
+oldest=$(date --date "3 months ago" '+%Y%m%d')
+echo "Removing old releases ... <= next-$oldest"
+
+old_tags=$(git tag -l 'next-*[0-9]' |
+ awk -F - '$2 ~ /^[0-9]*$/ && $2 <= '$oldest' { printf("next-%s\n", $2); }')
+
+[ "$old_tags" ] && git tag -d $old_tags
+
+echo Pushing to korg ...
+git push --prune korg
+
+echo Pushing to korg-history ...
+git push korg-history
+
+echo Pushing to history
+git push history
+
+echo Pushing patch to kernel.org ...
+cd ..
+xz -v -9 "$p"
+kup put "$p.xz" "$p.asc" "/pub/linux/kernel/next/$p.gz"
+
+ssh -O exit git@gitolite.kernel.org