Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

With SVN how can I keep another developer from overwriting me?

I'm not sure how to do this. I just started using SVN on a real project. I have everything working correctly. But, I'm the only one using it. Now I want to introduce a second person to the process.

I downloaded tortoisesvn on my windows machine and did a checkout of the main trunk. I can edit a file and commit my new file. Everything works.

Now, I want the second guy to do it, while I am doing something. Usually he might be working on another file and we would agree on a time to export our committed files to the test server (my thought anyway), but what if we are working on the same file? for example, a config file. Maybe we both need to change it. How can I (or he) keep the other one out of it while someone else changes it. If one of us commits a new update it will erase what one of us has just put in. Not sure what to do here.

like image 610
johnny Avatar asked Nov 29 '22 18:11

johnny


2 Answers

With SVN, the goal is not to grab a file and say "This is mine, don't touch it". The goal is to MERGE your changes when you are both finished. The number of cases where two people are truly making incompatible changes are small and when they happen, the developers need to get together on the best way to merge them - as opposed to having a race to who wins the file lock first.

Always Update before Commit, so that you merge in their changes with yours.

like image 154
Russell Steen Avatar answered Dec 09 '22 09:12

Russell Steen


No, it will not erase anything.

If two people change a file and try to commit it, the second person to commit will get an error message saying the file has been changed since their last update.

That second person then does an update. If SVN can do so, it will merge them, preserving the changes of both people. If it cannot (usually only the case if you change something in the same place in the file), it will tell you and you will have to handle the conflicts.

like image 34
Michael Madsen Avatar answered Dec 09 '22 08:12

Michael Madsen