A 302 redirect is an HTTP status code that informs search engines of a temporary redirection of one URL to another. If users reach the original URL, the search engine automatically redirects them to the (temporary) new one.
In practice, you can easily confuse 301 and 302 redirects, but there is a fundamental difference between them. 301 redirect is a status code that signals the permanent redirection of one URL to another. However, if we only want to replace URLs temporarily, we use a 302 redirect. This way, we tell search engines to redirect users to the new URL, but only for a specific time. At the same time, thanks to the 302 code, Google knows that the original page was not removed but only temporarily replaced, and therefore keeps it in its index.
We often use temporary redirection (302 redirects) when redesigning or updating a page and subsequent A/B testing.