I'm looking for advice on this as this happened to me recently. A co-worker needed a portion of my code to work on his project so I gladly assisted this co-worker but insisted that my code was not complete and was NOT to be distributed to anyone else due to it being incomplete, and I would potentially be blamed for possible errors that occur due to the code not being ready for distribution.
This co-worker took my code and made edits to suit his/her project and immediately took ownership of the entire project including my code saying s/he made this easy-to-use group of functions that will improve the company by all having the same code base. This was topped off with me being emailed saying "Okay, I set up this project that you can insert your code into. Let me know if I can help you." I wasn't sure how to react to this betrayal and stomping on I feel.
I worked a good long time on this code base to help the company out and help improve our coding process making custom functions and all that in
C++, and other languages the company uses all with very well (at least I think) commented code that told you exactly what each thing did. I just feel betrayed and stabbed in the back. I feel I worked so long on this project just so this co-worker could come in and make a few edits ignore my request to NOT send it to entire company until I finished it and had the nerve to call it theirs.
Question: What would be a good way to react to this and future situations in my career? I've been working at this company for almost 5 years and this is the first time something like this has happened. I thought I could trust this co-worker. Maybe my manager will ask "Well, what have you done in the last x months?"