Just started with SVN. Here is a very basic set of questions that I have after reading several articles, tutorials and playing around for a couple hours.
When I create a repo is it supposed to hold all of my projects or just one? It seems odd that after running import on a few projects that my revision count is going up for each new project added.
If I am working by myself, are tags and branches still necessary and good practice?
How do you know when it is time to commit a project? Especially when writing it from scratch?
At the end of the night, do you always commit your work? or do you leave it checked out?
Do you keep an exported copy of projects at all times? What if the SVN DB borks? Can you recover from a borking? If it did bork and I only had a checked out copy, would I have to remove all of the .svn directories myself? Would doing so equal an exported copy? Do you archive exported tags elsewhere?
Do I ever need to directly access the repository directory? Would it be better to just hide this directory? (.svn)
Is there an easier way to do a checkout and import then entering the whole file path (file:///Applications/MAMP/SVN/)? Can I set a repo once that I will always use?
edit thanks for clearing up all these questions. Also for the suggestions on gui's. I got it set up through textmate which is unbelievably awesome. Still have to do the initial import and checkout on the CL though...
Here's my take on this:
When I create a repo is it supposed to hold all of my projects or just one? It seems odd that after running import on a few projects that my revision count is going up for each new project added.
This completely depends on your taste: there are benefits from having several projects in a single repo (eg. copying code from one project to another), but if you e.g. want to give others access to just a single project, having a big repository can make things a bit trickier.
Regarding the revision number: don't worry about it. Those numbers are only meant for administration so you can easily merge code, go back to a specific version, etc.
If I am working by myself, are tags and branches still necessary and good practice?
Absolutely! Especially if you want to release your code to others or other places (on a server for instance). You'll want to know which version you shipped (tagging). And you may want to fix something in an older release while not being bothered by the changes that you already made during further development (branching).
Furthermore: you may want to try something while you are not sure whether you want to continue on that path: create a branch, experiment and either merge it back to trunk or throw the whole branch away.
How do you know when it is time to commit a project? Especially when writing it from scratch?
I like to make small commits. Created a boilerplate project? Commit it. Added feature X? Commit it. Refactored your FooProcessor code? Commit it.
By commiting these small steps, I find it easier to backtrack what I've done. If I fixed a certain bug and in a month I come across a similar problem, I can easily determine what was part of the fix and what wasn't. (That is: if it's in another commit, it was not part of the fix. :) ) The only rule I have, which is especially important when working in a team: don't commit broken code. It can be unfinished, but it should not hurt anyone that happens to check out the code.
At the end of the night, do you always commit your work? or do you leave it checked out?
I try to commit at the end of the day (so when something happens to my computer I have a backup, or if I get sick my coworkers can continue where I left off). But only if I have reached a point where it is safe to commit.
Do you keep an exported copy of projects at all times? What if the SVN DB borks? Can you recover from a borking? ...
I don't have a checkout of the whole repository, I have backups of the repository. I've never had problems with the SVN repository though.
... If it did bork and I only had a checked out copy, would I have to remove all of the .svn directories myself? Would doing so equal an exported copy? ...
Depends on whay you want to achieve. But removing the .svn
files would in effect be the same as an svn export.
... Do you archive exported tags elsewhere?
No, not really. Unless you want to call the checkout of the release on the production server an 'archive'.
Do I ever need to directly access the repository directory? Would it be better to just hide this directory? (.svn)
On a *nix system, the .svn
directories are already hidden (that's why they start with a dot). You should not want to mess around in those directories though.
Is there an easier way to do a checkout and import then entering the whole file path (file:///Applications/MAMP/SVN/)? Can I set a repo once that I will always use?
As others have already mentioned: have a look at GUIs for Subversion. I personally like TortoiseSVN.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With