Recently I started working on a “portable” version of a project by copying all the files to a new directory. The portable directory differs from the stable directory only in terms of what has been deleted or commented out; nothing has been added.
I finally decided it’s time to learn source control. Everyone says simply starting is more important than anything else, and I ultimately chose Mercurial since it’s good for branching and (more importantly) I liked the tutorials I found online (e.g., http://hginit.com and http://hgbook.red-bean.com/).
I made a repository for my stable directory, and a clone in a central repository (Dropbox). I’m committing, pushing, etc. Now, however, I’d like to link my (already existing) portable directory with the central repository. I’d like to be able to, say, fix a bug in my stable code, push it to the central repo, and then pull the bug fix into the portable version–without changing anything else in the portable code.
I’m unsure what to do first with the portable code. If I clone the central repo to the portable directory, won’t all my portable code be overwritten the first time I update the portable directory?
You will need to clone the “central” repository to your portable directory before you will be able to do any work like you describe. However, an easy fix is to copy you portable directory somewhere else and create a new, empty folder. Then, clone your repository into that directory. After that, you should be able to just copy and paste your previous portable directory into the cloned version and allow it to overwrite the files there. That will allow you to commit those changes into version control and be in sync with the central repository.
If this method won’t work, you will still have to clone the central repository and then make all of your “pending” changes to the existing portable location by hand to your new cloned version.