Question

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.

Was it helpful?

Solution

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.

OTHER TIPS

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.

It sounds like you need a basic understanding of how SVN works. I suggest you read the section Versioning Models from the book.

This problem cannot occur because Subversion (any decent SCM actually) will only let you commit AFTER you have performed an update. If Subversion cannot merge your changes, it will cause a conflict, which you have to resolve manually.

SVN has locks in the rare case that you need to use them. Check out the Locking section of the SVN book for more details.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top