Version Control is for Ladies & Real Ladies use Git
I love git! It has a monster!
gitmonster
What you need
- Mac OS X (this works on linux & pc, but i don't have the precise installing instructions for those)
- git installer for leopard
- bravery. we are doing command line stuff here ladies. don't be fooled, we can do anything.
Jump to the git installing instructions Intended audience: This article is written directly for women web developers who are not currently using version control because the command line aspect of it seems too daunting. This is also for everyone else. However, today I was particularly inspired by this presentation by webchick.
Version Control is for Ladies
What is version control
version control just means a computer program that archives files, and lets you leave messages about changes you, and others, made to the files. Programmers use version control all the time, but it involves the 'command line' -- which is that black popup box that is a computer application (Terminal on a mac) which you might accidentally open sometimes. The command line lets you talk into the guts of the computer, and, yes, you could break things. But if you can update a live website, whatever. You can do this. A lot of 90's web developers did not (do not) use version control - probably because most of us did not have access to computers that allowed us to play with, mess up and experiment with the 'command line' - so don't feel bad if you haven't used it before. We'll start now. Here is a good description of git 'for designers
What version control will offer you.
Having some version control on your own computer will help improve your workflow - saving you time and energy. If you work on projects with lots of little files (such as for websites), then version control is going to make your life better and take away some of the stress of messing up and over-writing yourself. No need to save multiple versions of files all over the place. Even better - using version control with other people will allow a new level of collaboration.
Don't get turned off by the ugly names and horrible documentation
First off, trying to learn version control from the internet was way scary. People showed me the subversion handbook...which is unreadable. And now that I've been using subversion (SVN) for over a year, now the handbook is starting to make sense. I learned how to use version control in two ways: 1. a co-worker figured out how to install it, and how to use it with our web development program. 2. i played around with the tools in the web development program* until i understood how 'version control works' - and then i started messing with the command line stuff. After a year of breaking subversion repositories on my own local web server, I kind of understand it now. (*The web development program was eclipse, which is vaguely similar to dreamweaver in that it helps you manage web projects. Eclipse is really much more than that & I have totally abandoned dreamweaver forever. I have also abandoned Eclipse now, for Coda.)
cvs? svn? git? mercurial?
These are just different programs. cvs was an old form of version control, svn was a little newer - and it is pretty common. It would be smart to learn how to use it. If you have a dreamhost account, you probably can start a 'subversion repository' today. git is a newer one i am trying and i kind of LOVE it, it's very cool to have on your own computer. mercurial is one that other people like. People argue about which ones are better. But ladies, if you are a web developer who is just coming in to this...let's just skip you ahead to the new cool thing, git, and not worry too much about cvs and svn. Those will probably make a little more sense...especially after you try git. You'll be awesome.
let me try to explain
The git website is pretty good. I found the 'crash course for git for svn users' to be helpful. But there's some basic stuff you need to know first. Most of which kind of came together for me today, which is why I am now sharing it. In all these version control systems, they seem to have some similarities.
Things to know
- There are 2 (two) sets of files involved:
* your files (for example, all the files in a website)
* 'the files in the "repository" - basically, an archive' - You have to install a program on your own computer that communicates between your files and the ones in the repository. (a 'client' - it is kind of like an ftp program)
- You will probably want to also have a graphical user interface (gui) - meaning, a program that lets you click on files and save them without the command line because if you are really used to working on web projects and dealing with thousands of files, well, that's why we have graphical user interfaces....duh. Don't feel bad. You aren't cheating. You're smart with your time and energy. That's the point, right?
- These programs are mainly written to work with the command line.
- svn and git both install hidden folders in your local files. a folder named .svn will be placed in every single file folder in the file folder you connect up to a repository. Yes! every little folder! git seems to just install 1 folder...but don't quote me on that.
- Screwing up the folders in your archive will screw up your connection to the repository
- Deleting those hidden folders (completely) will disconnect your folder from version control. That's it - that information isn't stored anywhere else on your computer.
- You might also want to make a sticky note, or just a simple text file with all the commands you want to use. You can cut & paste them into the command line.
- To save your wrists, on Mac you can create these things called 'bash profiles' - this sounds horrible, but all it is a settings file for when you are typing stuff in the command line window. You can use that profile to make shortcuts for anything you don't feel like typing. It's super easy to do, and I will write up how to do that as well.
How to do version control: in plain English
- Start with a normal folder of files, for example, a website folder that is stored on your computer.
- Install a version control program on all computers involved in the sharing and storing.
- In the version control program, make a folder to store the archive
- With that 'normal folder of files,' using the version control program, tell it that it should talk to the archive
- put files in a queue of files to get added to the archive
- Using the version control program, send all the files in the queue to the archive
- Periodically update, or resync the files. This will 'download' files to your local folders.
- You can also manage the 'archive' - telling it that you would like to file a certain version - pinpointing it in time. For example, if you were redesigning a website, you might archive the website the way it was.
Warning: This is not the language used in version control!
Instead, this is what they tell you:
- Your local folder mywebsite
- Go get some tarball and also XCode and a binary of git, or maybe a parrot, then clone a plugin. Compile the code yourself and then do git or svn help
- make your repository with a long crazy looking command
- initialize your local folder
- run add
- commit and add a message
- run update
- branches tags and trunks. did we mention version control also lets you do diffs and patches? rock on! svn is sweet!
Ok seriously, version control really is very awesome. But you would never know by looking at it!
Getting, Installing and Using git on Mac OS X Leopard
Getting & Installing git
- git installer for leopard - run its install
- Optional Tip: install XCode.This is a toolset of Mac OS X which will make a bunch of the 'command line things' work - which if you get adventurous, will save you headaches. Your mac is not all-powerful out of the box. You will have to register on the Mac website. I installed this because I am trying to figure out how to use git and svn at the same time.
- (I am still looking for a good git gui)
That's all - see it was so easy to install git. And, for this tutorial, all we are doing is using git locally.
Using git
Yay!
1. Open the Dreaded Command Line
- The Terminal program is located at: Macintosh HD > Applications > Utilities > Terminal
- Drag that icon to your dock so you are encouraged to use it more often.
- Open Terminal.
2. How (not) to break your computer
- Do familiarize yourself with 'UNIX' and basic commands
- Typing 'rm' means remove - as in remove files and possibly folders if you can find the secret command that makes it remove whole folders (google: unix remove folders recursively). I'm not telling you about that just yet!
- The commands can be very powerful
Baby UNIX
Here are some commands that are safe, so you can practice doing stuff in the command line
- type
pwdand hit enter. - Oooh fun, see this is the directory you are in
/Users/Chacha/
- type
lsand hit enter. - These are the files in your folder
- type
ls -laand hit enter. - These are the files in your folder, along with information about who owns the files
- type
cd DocumentsthenlsYou should see a list of files in your Documents folder - type
cd ..You will be back in the directory you were just in
COPYRIGHT.txt Music profiles Desktop Pictures robots.txt Documents Public scripts Downloads Send Registration themes INSTALL.txt Sites Library Movies
total 264 drwxr-xr-x+ 43 Chacha staff 1462 Jul 8 18:25 . drwxr-xr-x 5 root admin 170 Jun 18 22:05 .. -rw------- 1 Chacha staff 3 Jun 18 22:05 .CFUserTextEncoding -rw-r--r--@ 1 Chacha staff 6148 Jul 6 12:17 .DS_Store drwxr-xr-x@ 3 Chacha staff 102 Jul 5 16:58 .DownloadManager drwx------ 3 Chacha staff 102 Jul 8 20:01 .Trash etc.....
There's a lot more than that, but those are some essential commands.
1. See if git actually was installed properly
- Type
git helpand hit enter. You should see a list of commands that say things like 'git this, git that'. If not...something is wrong with your installation.
2. Make a practice folder and git-ify it
- Using the Finder, make a test folder with files in it. Example,
gittest - Open the command line. Using
cdnavigate to the folder you just created - When you are in the folder, you should be able to see a list of the files in your folder. When you make a folder into a git-enabled folder, it would be a good idea for you to always navigate into that folder when running command line commands - to avoid making big mistakes that could trash your computers. Be very careful! When you are learning, do this when you are fully awake, and carefully read what you are typing before hitting enter. You do this at your own risk.
- To make your folder into a git folder, type
git init
chachas-laptop-2:gittest Chacha$ git init Initialized empty Git repository in /Users/Chacha/gittest/.git/
This will initialize your folder. This will generate a new hidden folder in your folder called .git - and in that folder is stored information about your git repository.
- To add files in your folder to the git repository ('archive'), type
git add .This will find all files that have not been added, or have changed. There is no output message. - To put all the files added into the repository, type
git commit -m 'this is my message'
chachas-laptop-2:gittest Chacha$ git commit -m 'this is my message' [master (root-commit) 25edb0d] message 1 files changed, 1 insertions(+), 0 deletions(-) create mode 100644 testfile
3. How to use git without an internet connection (**I am still figuring this one out... this is what i will attempt***
The very cool thing about git is that it is really easy to move the repositories around. This means sharing the repository with yourself on your own computer, or sharing it with someone else when you don't have the internet. That is something that's very tricky to do with svn.
- Copy the folder from one computer to another with a flash drive. This is the main version of the respository.
- Open terminal. Change directories to the place where you want to work.
- Enter this in the terminal:
git clone folder_on_flash_drive name_of_projectThis makes a local working copy of git that will let you save changes back to the flash drive. - Commit normally from your working copy.
- Give the flash drive back to your work partner. They should also clone a copy of what's on the flash drive, if they didn't already. They can work & commit back.
- Now for the fancy part: Say you were both sitting next to each other and working on the same exact files, but different parts of the (text/code) files. There are a few things you can do to put the files back together again.
- According to the git website, the next thing you do is 'git pull.' (still working on this! 7/19/2009)
4. Hide .git from svn (advanced)
So I tried my own method of dealing with git & svn. I haven't been able to figure out git-svn - BUT when i need to be commiting code back to svn, I've just been moving the .git folder our of my directory & not using git. This works because I use svn during the day, but git on my own computer, so I don't need them both at the same time. This might work with cvs too.
Update (7-26-09)
Apparently bazaar is super usable & lets you rename file folders without breaking your version control system. That sounds pretty awesome. I am still trying to figure out git and really only have time to do that when I am on the train. I decided that I can spend a few minutes once or twice a week investigating the git commands. This is why it is taking a while to figure it all out. Finding/watching some screencasts might be a good idea, too.

