Simplest version control system - version-control

I want to set up a source code control system that:
is networked, so users can access it at work or on the road
does not need to provide sharing, lock mode is sufficient
there will be only three users and they will never be working with the same code
we have no system administrator and not much knowledge in that area so the set up and config must be dead simple.
will be installed on a Windows server
open source or free
Suggestions please.

the SIMPLEST system is what we here call the "Hey Chris" system. We have a networked drive that everyone can mount, and if you want to edit something you shoud "Hey, Chris, are you working on blahblah.cpp?" and Chris says "Nope." and then you edit blahblah.cpp, and stick it back on the shared drive... If you want versions, just back up the networked drive every night.
I never said it was the BEST system, just the simplest.

SVN covers all of these, and is quite easy to set up.
Wrt point 2, sharing tends to be better than locking, as a file that is locked by someone who then goes on holiday/dies/etc. needs to be unlocked by someone before it can be worked on by another developer. SVN supports sharing 'out of the box'.

Mercurial or Git

Try Subversion (svn).
Edit: Rich beat me to it =D. And yes, as he points out sharing is better than locking. Sounds like you're a SourceSafe user. Those were the same set of problems I was trying to address when moving out from SourceSafe =)

I'm surprised no one recommended the Fossil version control system. It checks all of the askers requirements. It's stable and simple, consists of just a single self-contained executable, allows easy admin with a UI and only uses HTTP(s). And yeah, runs on Windows.
In addition it provides a nice web interface, and also manages bug tracking, and wikis.
It's made (and used) by the SQLite people, and that's a guarantee of reliability for me.

The simplest version control system I am aware of is a Revision Control System RCS. It is a command line utility that is available out of the box on Linux systems. It's usage is quite simple.
First. Inside current directory, create a directory where RCS's information will be stored:
$ mkdir RCS
Second. Store (check-in) a file into RCS:
$ ci -t-"My notes" notes.txt
Original file gets deleted.
Third. Restore (check-out) original file from RCS:
$ co -u notes.txt
Fourth. Edit file as needed, now it can be restored any time:
$ vim notes.txt
RCS is also working with binary files, and supports many subsequent changes to a file.

I can only add my voice to the "use subversion" chorus. But you were also asking about simple installation and administration.
For that I would point you to VisualSVN Server. It is an easy to use server installation on Windows. And it is free.
Or if you want to go with a manual setup (maybe because you don't want to use the apache bundled with visualsvn server) follow Jeff's Setting up Subversion on Windows.

I really dig Git and GitHub for this. Git is nice because each developer can check things in and go through the history even when they're offline (say, on an airplane or in the backwoods somewhere), then push their changes to a central repository when they are back online. GitHub works really, really well as that central repository, and includes a lot of very handy tools for reviewing and commenting on other people's checkins.
The basic commands that you use day-by-day boil down to:
git add .
git commit -m "this is a note"
git pull origin master
git push
Git handles most conflicts very well, and it's fast, fast, fast, since the entire repository is on each machine.
Kyle Cordes wrote a blog post about getting started on Windows.

I recommend Tortoise SVN. SVN is a source control environment that's easy to set up and use on Windows, and Tortoise is an add on that integrates with windows explorer.
Despite being simple to use, it allows different people to work on the same file and merge their changes. Even though that "can't happen" I predict at some point you'll be happy that it works that way.

Darcs provides all this and a lot more. It's a distributed version contoll system, which would make it easier to access the data on the road. You can send/receive patches (similar to revisions) through email or ssh.
The thing about darcs that I like the most is that it's really verbose. It really tries to help you.

Lots of recommendations for SVN, but I'm not sure I'd call that "simplest" from an admin point of view. You still need to set up a server, IIRC. In comparison, a DVCS like Mercurial makes no distinction between "repository" and "working copy". To put something on a server (which can be any folder you have file-sharing access to), you can just "push" it there.
You also mention working on the road. DVCS are particularly good at this. Your laptop will have the whole history, so you only need to touch the server if you want to push or pull, not just to do a diff or check the history.

Related

VCS for personal (one machine use)

Can anyone point me to a set of clear instructions of how to set up a VCS software. I am going to use it on my machine - so server and client on one machine.
I tried GIT that was recommended in various questions but its GUI was cumbersome and didn't make any sense to at all - I don't really have the time to delve into it either. I just need a SIMPLE VCS that will allow me to:
check in AND check out AND view history AND revert between versions
I also need it to be easy to set up, ideally it should be able to work out of the box.
I would recommend Mercurial.
And I assume you are using Windows, so TortoiseHG is your friend
http://tortoisehg.bitbucket.io
No server necessary (I am looking at you SVN/CVS), and your workspace can act as your repository. Bazaar (http://bazaar.canonical.com/) could also work, I just happen to like Mercurial better.

How do I do source code management without version control tools?

I work on a software project which has a suite of source code that undergoes periodic change. The code is typically promoted to a production environment, and development continues in a development environment. Emergency hotfixes in production need to be backported to development. A third environment for testing may also exist from time to time. Many developers work on this code at the same time, often needing to make changes to the same individual file.
In short, a classic use-case for version control software. Unfortunately, we have a stone age IT department, and we do all our development in a stock Windows XP environment with absolutely no possibility of using any other software without approval - which never happens. We are lucky to have Winzip.
So what's the best way of managing the above workflow without any real tools? At the moment we are just editing files on a Windows shared drive, making ad-hoc working copies into folders with names like "James's Copy of X", doing backups with Winzip, and calling across the room, "is anybody working on this file at the moment?"
Thanks,
James
Edit: Some clarifications:
The irony is that the system is hardly locked down at all - I could download, install and configure TortoiseHg in about 7 minutes. But I need to do this by the book.
I am also actively pursuing getting version control software through official channels, but ETA for that is 6-9 months if ever, so I'm just trying to do the best I can with what I have now.
Finally, trust me, you will be reading about this project on TheDailyWTF one day, so please help me out with what I can do now rather than what management should have done last week.
Get source control. Talk to management, refuse to work, do whatever you can to get it in.
Bring in a netbook, install a SVN server and use that. Run Git off USB drives.
Really - anything.
It is not just an industry standard now - it is irresponsible of you and your management to continue working like this.
After notifying management and explaining that this is an issue, if they do nothing, just let the inevitable happen. Something that shouldn't have been promoted to production will be (regression, bug, new feature, whatever). When they come to blame you, explain how source control can help ensure that such things do not happen again. Perhaps they will listen then.
Ok, two actual options occur to me here.
First. You have Winzip, and you appear to have web access since you're posting on Stack Overflow. Assuming you have the ability to upload files (which isn't a given, since you're still using a generic StackOverflow avatar) you could find - or build - an externally-hosted service that'll allow you to upload a ZIP file via a web browser, unzip it, and then commit the unzipped contents to a Git or Subversion repository. Stick a secure web front end on it (Apache + mod-dav-svn) and you'll have the ability to browse, review and commit changes to individual files. You won't get the benefits of local SVN/GIT capabilities like merging, but you'll have centralized project history. There could even be a quite lucrative business model in this - selling web-based SCM to developers who are stuck on IE6 and WinXP and can't install anything.
Second: You find a junior/admin in your IT team who's just as frustrated as you are at the draconian restrictions being enforced, persuade them that you know what you're doing, and get them to 'accidentally' set up a local administrator account on your workstation. WinXP is sufficiently insecure out of the box that this shouldn't be too hard to make this look like an accident.
Copy and paste the files into a seperate folder and call that folder vers_x, or get the windows backup utility to save them each day, or another backup utility to do the same? though the first post is correct, strike till vers cont is implemented.
Get git. git init on the current source "repository". Install git on everyone's pc's.
Also, the strike idea is definitely not so bad in this case.

Version Control: Taking on a project without any

I've recently taken on a project with no version control. I don't have any experience with version control myself. I feel it is the only way to go with this project (and probably any future projects now I think of it - I always trust myself too much..)
My question is - where do I begin with implementing version control on a project already in production? Bearing in mind I haven't used version control before so really it's two separate questions:
Starting out with version control
Implementing it on an already live
project
For background, the project is a php/mysql driven website using bits of javascript, I'm working on a (Windows) XAMPP server and I'm very keen to learn this new world of version control!
Congratulations, you are headed in the right direction!
You'll first need to choose a version control system. My current favorite is Git. Unfortunately, I don't think that Git is an easy introduction to version control. I have also used Subversion and Perforce.
Subversion (http://subversion.tigris.org/) works on many platforms, is used in a lot of projects, and has some nice GUI tools available (such as TortoiseSVN on Windows). Command-line tools are also available. It's also free. You can run it in "local filesystem" mode, meaning that you don't need to set up a separate server. It's come a long way from it's "better than CVS" roots.
Perforce (http://www.perforce.com/) is pretty nice. Its Windows implementation seems the best (last I checked, their cross-platform GUI was pretty lousy). You primarily use a GUI to interact with it, though again there are command-line tools. It's commercial software, but open source projects can get free licenses by contacting the company. The biggest drag is that you will need to set up a server. To get started, you could run the server on the same box that you develop on, but that's probably a bad idea in the long run. I found Perforce to be very good for 2-8 person teams; I don't know how well it would work with more.
The big advantage to Git (http://git-scm.com/) is that it requires virtually no set-up. Once installed, you can execute git init in any directory to create a new git repository. The revision history is kept inside the project's directory. You can start out with just local versioning, and you can scale up from there. If Git seems scary, you could also check out Mercurial (https://www.mercurial-scm.org/). I haven't used it, but I understand that it shares some of the same underlying principles as Git.
Avoid CVS. It's on its way out, and no new project should be using it unless they need to do so.
Adding source control to an existing project is easy. The hard part would be making sure that everybody is willing to use source control. If you're working alone, then it's just personal discipline. If you're part of a team, though, and some people have reservations, you will have problems. Try to get everybody on board, and be available to try to answer their questions. If people don't know how to use a tool, they simply won't use it.
Start here: http://svnbook.red-bean.com/
I've found SVN to be the easiest version control system to use, especially for beginners. It's pretty simple to start, the only real decision you have to make is where to host your stuff. There are a couple free svn servers available, but if you're really serious about your work you should host your own.
The first thing to do is to pick a version control paradigm (centralized versus distributed). To answer that, you'll need to take a look at your team and how you intend to handle check-in, check-out, merging, and branching. Once you pick a paradigm, you can choose a version control system. The mainstream systems are Subversion for centralized version control and Git and Mercurial for distributed version control.
If the project is live and working, then that should be your initial check-in to whatever version control you are using. You need a reliable baseline that you can revert to and have 0 work to deploy something that works. If your project is not functional...well, good luck. You might want to check in to start using version control and then decide how you want to proceed (either get the project to a stable and functioning state and then restart your repository or have your initial check-in be a broken system).
If the rest of the team doesn't see the benefit with version control, I would recommend installing your own system on your machine and, at the very least, use it for your own work.
Be prepared for some resistance from management and/or your co-workers. Management may not want to invest the resources for a repository machine -- these things need to be installed, maintained, backed-up, etc. Or they may object to you spending time on an "extra" like a RCS.
Your co-workers, especially if they're unfamiliar with any RCS, are likely to resist using it, or complain that it's too hard to use. There's a learning curve to any new tool, and source control systems are no exception. It's worth the time to learn, though.
My advice is to pick one -- any one that strikes your fancy -- and start using it. Don't worry about getting it 100% perfect the 1st time, it probably won't be any worse than what you have now, which is one misplaced keystroke away from oblivion.
Play with it. Check files out into a separate workspace and hack things up, knowing that it doesn't matter; you can always revert it. Learn how to use your new tool with some GUI frontends (I'm fond of 'svn diff --diff-cmd=kdiff3', myself). Get to the point where you know how to check in & out, tags things, branch, and merge. Then show your co-workers.
Personally, I'm fond of svn, but I didn't choose it; it chose me.
Step 1: Download Mercurial.
Step 2: In your favorite command line, go to the root of your source directory and type hg init.
Step 3: Do a make clean or equivalent (ie. all you want is source, no generated files).
Step 4: Type hg addremove.
Step 5: Type hg commit.
From this point on you can:
Examine the changes between your most recent commit and now: hg diff or hg status.
Make checkpoints in your code: hg commit.
Return to previous checkpoints: hg update -C -r 0
Congratulations, you are now using version control: It's really not that hard, and it's very, very useful (if for no other reason than you can look at the changes you've made to see if they make sense).
At some point you'll probably want to learn about branching (if only so that you have a backup copy of your repository on another machine) at which point you can turn to the documentation or the book.
I don't know if there is something similar for php etc, but an interesting resource here is "Brownfield Application Development in .NET". In many ways, this only uses .NET for the examples; most of the book is really about tackling policies exactly like you mention:
how to introduce source control
how to introduce unit testing
how to introduce continuous integration
etc
and all the concerns/consideration that go with them.
Partly relating to the code; but also relating to the "human" factor; colleagues, managers, etc. I highly recommend it; but you might decide the .NET background is inappropriate for you (it is a good fit for me ;-p).
You can look here: git-for-beginners-the-definitive-practical-guide
This one is a distributed version control system that currently has a good windows support with Git on Windows and a shell extension with TortoiseGit
An addition to other answers:
If the project you want to put under version control have had some releases, and if those versions are available for example as tarfiles (e.g. project-0.1.tar.gz, project-0.2.tar.gz, project-0.3.tar.gz, ...) you might want to consider importing those versions into your chosen version control system. Git for example has import-tars.perl and import-zips.py in contrib/fast-import/ directory, and writing support for other files in other programming languages for git fast-import should be easy.
Sidenote: my preferred version control system is Git.
See also: Good link or book for basics and theory of version control question.
I learned the concepts from the pragmatic series:
example for subversion, they also have books on GIT as well.
I only have experience with SourceSafe and SVN.
SourceSafe seems to have issues with corrupting it's own database, on a team of 5 we were repairing the db probably once a month. It's easy, but still something you shouldn't have to deal with. It's difficult to label code too and use that label for anything practical.
SVN is nice, it's simple to install on Linux or Windows. Most IDEs have a plugin for it, and if you're using Windows there is an Explorer extension (TortoiseSVN) that allows you to do all your operations right from Windows Explorer. There's a lot of SVN tools out there for every OS, it's very well supported. SVN also integrates with TRAC (a bug tracking system), and Bugzilla so you can tie your work tickets to code.
I will say that [HOW you use version control is probably just as, if not more important than which package you use][2]. Using it simply as a library is a very rudimentary application of it, but for a 1-2 man team making a website or an app where you won't be maintaining builds and versions, you'll be ok.
When it comes to version control, anything is better than nothing.
Wow, everyone is just boosting his favorite version control utility.
OK, to answer your question, how do you put a project under version control?
It's not that hard, once you pick a version control utility (be it, git, svn, hg, bzr .. whatever) there's usually a command or two to initialize a repository then add all the relevant files to it.
For instance, in git it might be something like:
$git init
$git add --all
$git commit -m"First commit"
Now, about choosing a version control utility, that's a tough question and highly depends on what you want. You might want to have a look at this question:
Popularity of Git/Mercurial/Bazaar vs. which to recommend
The only tools you should consider choosing among are:
git
svn (Subversion)
hg (Merculiar)
bzr (Bazaar)
mtn (Monotone)
Everything else is either old or commercial.
svn follows a server-client model; there's a central repository. If you're a one-man team then the only thing this means to you is that you have to setup a server and make sure it starts with the computer. Though I heard that you can do away with the server. A bit of googling turns up this guide for using svn without a server
All other tools follow a distributed model, again, if you're a one-man team, the only thing this means to you is that there's no server to setup.
The advantage of svn is that it's been there for a while and has many gui front-ends and better IDE integration.
I can't compare git to hg (merculiar) since I haven't used the latter, but git has a unique storage model compared to svn and hg.
bzr is said to be easier to use, but slower (it's written in python).
I'm personally satisfied with git, but you should do your own research; or maybe just choose one and stick with it. As far as I can tell, they're all mature and stable.

Know of any source-control "stash"-like programs?

I once ran across a commercial tool for Windows that allowed you to "stash" code changes outside of source control but now I can't remember the name of it. It would copy the current version of a document to a backup location and undo your checkout in source control. You could then reintroduce your backed up changes later. I believe it worked with multiple source control systems. Does anyone know what program I'm trying to describe?
The purpose of my asking is twofold: The first is to find a good way to do this. The second is because I just can't remember what that darn program was and it's driving me crazy.
Git: http://git-scm.com/
You can use git stash to temporarily put away your current set of changes: http://git-scm.com/docs/git-stash . This stores your changes locally (without committing them), and lets you reintroduce them into your working copy later.
Git isn't commercial, but is quickly gaining many converts from tools like Subversion.
I think the product you're thinking of is "CodePickle" by SmartBear Software. However, it appears to be a discontinued product.
The term that seems to be used for the type of functionality you're looking for seems to be 'shelving'.
Microsoft's Team system has a 'shelve' feature.
Perforce has several unsupported scripts, including p4tar and p4 shelve
There are several 'shelving' tools for Subversion, but I don't know how robust they are.
I'm no git user myself, but several of my colleagues are, and they seem to like it precisely for this purpose. They use the various git wrappers to commit "real" changes to the SCM system used by their company, but keep private git repositories on their drives which they can keep their changes which they don't necessarily want to commit.
When they're ready to commit to the company's SCM server, then they just merge and commit upstream. Is that what you're looking to do?
Wouldn't it be a better idea to store your private changes in private branch, using e.g. svn switch to change to main branch whenever you need to?
Mercurial has the Shelve Extension which does what you want.
You can even select which changes from a single file that you want to shelve if you really want.
In Darcs, you either don't record the changes you want stashed (it asks you about including each change independently when you record a new patch), or put them in separate patches that you don't push upstream.
There's no need to fully synchronize your local private repos with public/upstream/other ones. You can just cherry pick the patches you want to push elsewhere. Selecting patches can also be done with patterns, so if you adopt a naming convention for your stashed patches you can push everything but them easily.
That way, your private changes are still in revision control, but they aren't shared until you want them to be.
I found an excellent article about obtaining similar functionality using Subversion branches:
Shelves-in-subversion
And then there's the old fallback... 'patch', or even the old "copy everything to another location, then revert".
Both of these are less convenient than using tools that are part of most VCS systems, though.

What is the difference between all the different types of version control?

After being told by at least 10 people on SO that version control was a good thing even if it's just me I now have a followup question.
What is the difference between all the different types of version control and is there a guide that anybody knows of for version control that's very simple and easy to understand?
We seem to be in the golden age of version control, with a ton of choices, all of which have their pros and cons.
Here are the ones I see most used:
svn - currently the most popular open source?
git - very hot since Linus switched to it
mercurial - some smart people I know swear by it
cvs - the one everybody is switching from
perforce - imho, the best features, but it's not open source. The two-user license is free, though.
visual sourcesafe - I'm not much in the Microsoft world, so I have no idea about this one, other than people like to rag on it as they rag on everything from Microsoft.
sccs - for historical interest we mention this, the great-grandaddy of many of the above
rcs - and the grandaddy of many of the above
My recommendation: you're safest with either git, svn or perforce, since a lot of people use them, they are cross platform, have good guis, you can buy books about them, etc.
Dont consider cvs, sccs, rcs, they are antique.
The nice thing is that, since your projects will be relatively small, you will be able to move your code to a new system once you're more experienced and decide you want to work with another system.
Eric Sink has a good overview of source control. There are also some existing questions here on SO.
To everyone just starting using version control:
Please do not use git (or hg or bzr) because of the hype
Use git (or hg or bzr) because they are better tools for managing source code than SVN.
I used SVN for a few years at work, and switched over to git 6 months ago. Without learning SVN first I would be totaly lost when it comes to using a DVCS.
For people just starting out with version control:
Start by downloading SVN
Learn why you need version control
Learn how to commit, checkout, branch
Learn why merging in SVN is such a pain
Then switch over to a DVCS and learn:
How to clone/branch/commit
How easy it is to merge your branches back (go branch crazy!)
How easy it is to rewrite commit history and keep your branchesup to date with the main line (git rebase -i, )
How to publish your changes so others can benefit
tldr; crowd:
Start with SVN and learn the basics, then graduate to a DVCS.
I would start with:
A Visual Guide to Version Control
Wikipedia
Then once you have read up on it, download and install SVN, TortoiseSVN and skim the first few chapters of the book and get started.
Version Control is essential to development, even if you're working by yourself because it protects you from yourself. If you make a mistake, it's a simple matter to rollback to a previous version of your code that you know works. This also frees you to explore and experiment with your code because you're free of having to worry about whether what you're doing is reversible or not. There are two major branches of Version Control Systems (VCS), Centralized and Distributed.
Centralized VCS are based on using a central server, where everyone "checks out" a project, works on it, and "commits" their changes back to the server for anybody else to use. The major Centralized VCS are CVS and SVN. Both have been heavily criticized because "merging" "branches" is extremely painful with them. [TODO: write explanation on what branches are and why merging is hard with CVS & SVN]
Distributed VCS let everyone have their own server, where you can "pull" changes from other people and "push" changes to a server. The most common Distributed VCS are Git and Mercurial. [TODO: write more on Distributed VCS]
If you're working on a project I heavily recommend using a distributed VCS. I recommend Git because it's blazingly fast, but is has been criticized as being too hard to use. If you don't mind using a commercial product BitKeeper is supposedly easy to use.
The answer to another question also applies here, most importantly
Jon Works said:
The most important thing about version control is:
JUST START USING IT
His answer goes into more detail, and I don't want to be accused of plaigerism so take a look.
The simple answer is, do you like Undo buttons? The answer is of course yes, because we as human being make mistakes all the time.
As programmers, its often the case though that it can take several hours of testing, code changes, overwrites, deletions, file moves and renames before we work out the method we are trying to use to fix a problem is entirely the wrong one and the code is more broken than when we started.
As such, Source Control is a massive Undo button to revert the code to an earlier time when the grass was green and the food plentiful. And not only that, because of how source control works, you can still keep a copy of your broken code, in case a few weeks down the line you want to refer to it again and cherry pick any good ideas that did come out of it.
I personally (though it could be called overkill) use a free Single user license version of Source Gear Fortress (which is their Vault source control product with bug tracking features). I find the UI really simple to use, it supports both the checkout > edit > checkin model and the edit > merge > commit model. It can be a little tricky to set up though, requiring you to run a local copy of ISS and SQL server. You might want to try a smaller program, like those recommended by other answers here. See what you like and what you can afford.
Mark said:
git - very hot since Linus switched to it
I just want to point out that Linus didn't switch to it, Linus wrote it.
If you are working by yourself in a Windows environment, then the single user license for SourceGear's Vault is free.
We use and like Mercurial. It follows a distributed model - it eliminates some of the sense of having to "check in" work. Mozilla has moved to Mercurial, which is a good sign that it's not going to go away any time soon. One con, in my opinion, is that there isn't a very good GUI for it. If you're comfortable with the command line, though, it's pretty handy.
Mercurial Documentation
Unofficial Manual
Just start using source control, no matter what type you use. What you use doesn't matter; it's the use of it that is important
Like everyone else, SC is really dependant on your needs, your budget, your environment, etc.
At its root, source control is designed to provide a central repository of all your code, and track who did what to it when. There should be a complete history, and you can get products that do full changelogs, auditing, access control, and on and on...
Each product that is out there starts to shine (so to speak) when you start to look at how you want or need to incorporate SC into your environment (whether it's your personal code and documents or a large corporations). And as people use them, they discover that the tool has limitations, so people write new ones. SVN was born out of limitations that the creators saw with CVS. Linus wanted something better for the Linux kernel, so now we have git.
I would say start using one (something like SVN which is very popular and pretty easy to use) and see how it goes. As time progresses you may find that you need some other functionality, or need to interface with other systems, so you may need SourceSafe or another tool.
Source control is always important, and while you can get away with manually re-numbering versions of PSD files or something as you work on them, you're going to forget to run that batch script once or twice, or likely forget which number went with which change. That's where most of these SC tools can help (as long as you check-in/check-out).
See also this SO question:
Difference between GIT and CVS