Check out latest commit rather than restarting web terminal
A Web Terminal is being added to the Web IDE https://gitlab.com/gitlab-org/gitlab-ee/issues/5426 which will eventually make it easy to run tests. Initially, when a commit is made the web terminal will be restarted against a new job, giving us a fresh environment. This could take a while, and most of the time only code will be changed not dependencies.
To prevent long waits and the user losing their session, we should checkout the latest commit rather than resetting everything.
Proposal
If a web terminal session is open in the web ide, and a commit is made, instead of restarting the web terminal, we should run git checkout -f <branch> to get the latest changes. This will be faster than restarting a new job.
Links / references
Edited by James Ramsay (ex-GitLab)