Luckily, my partner in crime is easy to influence, and he agreed to use Mercurial (if I recall, he suggested it). We spent some time admiring Joel Spolsky's tutorial including his use of Balsamiq for the illustrations. We chose BitBucket it for two reasons: Mercurial support and free private repositories.
So, below is a log of the steps we used this morning to put our unversioned project on BitBucket.
- Create a BitBucket account
- Create a repository
- Give it a name
- It automatically defaults to "private" which is interesting
- Select "Mercurial"
- Choose the language (e.g., C#, PHP, etc)
- Create the repo!
- When you're done, BitBucket very nicely offers you the command to clone the repository. Copy it!
- e.g. hg clone https://myname@bitbucket.org/myname/myreponame
- Back on your local computer, create a temporary directory somewhere with nothing in it (like C:\junk) and navigate to it in your command window.
- Paste that nice clone command that BitBucket provided for you and execute it.
- When it's done, you'll see a new folder with your project name, and inside that folder is a new folder called ".hg"
- Copy the ".hg" folder to the root directory of your unversioned code.
- This is our "cheat" and we will never do such a thing again!
- Go back to the command window an navigate to your project folder (where you just put the ".hg" folder)
- hg status to take a look at what will get added.
- If you see any files you want to exclude, note the file extensions so you can create a pattern (e.g., *.bak)
- hg add -X *.bak (or whatever pattern you want to exclude).
- OR, you can just execute hg add if you're ready to just add everything.
- OR you can execute hg add -I *.php (or whatever pattern you want to include)
- hg commit -m "Initial commit" and wait for the command prompt. This could take a few minutes depending on the size of your project.
- hg log to make sure you see the changeset you're about to push.
- hg push to put the code on the repository (you'll have to supply your password).
- Browse to your repository on BitBucket to see if your code made it up there.
- Now clean up:
- Delete the temporary directory you created
- Immediately forget that anyone told you to copy your ".hg" folder anywhere
- Go into BitBucket and invite your collaborators to the repository (because that's why you put your code up there, right?)
You may wonder why we bothered with the temporary folder and copying the .hg folder. Really, it was pure laziness (which I consider a virtue in a developer):
- hg clone complains if the target directory exists and has content in it, and I just didn't want to be bothered with it
- I didn't want to be moving the source code around for the simple task of getting it into the repository in the first place
- moving the .hg folder has consequences, but for what we were doing here, it was harmless.
One of the things I noticed right away when exploring BitBucket is that the top trending project CodeIgniter Reactor had moved to GitHub (quite a while ago). I wonder where we will be a year from now.
Well, on to the next thing!
No comments:
Post a Comment