If I know about a colleague who is copying public available code into our software stack, infringing copyright law on purpose, too which extent am I liable under German law? Can I refuse working on the same files/project that include these copied lines of code?
I assume “our” software stack is owned by some company. And “public available code” usually comes with a license.
You are not saying which license. If the code was published under the GPL license for example, adding it to your code is legal. Distributing it without following the terms of the license is copyright infringement. That copyright infringement would likely be committed by your company.
However, if your company loses a court case and has to pay huge damages for this, or has their reputation destroyed, or is not able to sell the software, because you allowed this to happen, you would be likely to lose your job and possibly be sued for damages. Your colleague obviously even more so.
I would strongly recommend that you go to your management and inform them. Any company I’ve worked for would put an immediate stop to it (I never worked for companies creating open source software). In the unlikely case that they are Ok with it, best visit workplace.stackexchange.