Or use :<range>yank (see :he range for all possible uses of the range)
:-3,-1y
this does exactly what you are asking for: keep only (e.g. 3) lines in front of the current line. You could
:-1y :-2y
to display only the previous (or previous) line, etc.
:1,-1y
to pull everything to the last line
:1,.y
for this, including the current line (of course, you can do this with ygg )
sehe
source share