Do ou know SVN ?
I assume here that you know what is version control and what is its main goals. First of, version control allows you to have access to several versions of your sources.
Sometimes, when developping, you want to change some logic in your program, just to try out, but you don’t want to loose the source of the original program: well, source control will help.
Another scenario would that your are walking with a team on a same project. Therefore you need to share the code and be sure to have the final version on your local machine.
As understood here, is a kinf of central repository for the different versions of your code. This means that you should have a central repository hosted somewhere in the cloud.
Well, SVN or GiT are two tools/architecture that do the job. They are so popular that I don’t know if there is something else. So stick to the popular !!
GiT or SVN
I’ve shoosen GiT to manage code versioning. The main reason for that is that GiT is a distributed environment of source code repositories and, opposed to SVN, it doesn’t create dozens of annoying .snv subfolders everywhere in my code. When you work with a framework like Yii and you have a lot of folders, it really has its charms.
So Git will only create just one folder in the root of your project and that’s it. Much cleaner than SVN. The other advantage is that, as a distributed architecture, every developper has the complete code, not only the one that is on the centralized repository. This alow to keep some redundancy which is good in case one of the repositories fail. In case of failure, only the history of that repository will be lost. Which is mnimal ! Also GiT takes much less room in a disk than SVN.
There is a lot to talk about version control but that is not the goal here. So, let’s install GiT right away on Mac.
GiT on Mac
- Just get GiT installed on your Mac. Download and Install. : http://code.google.com/p/git-osx-installer/
- Now GiT on your machine needs to know who you are to sign your code when pushing changes to the repository. So open terminal on Mac OSX and type the following commands (you know where terminal is on your Mac, right ?)
git config --global user.name "Your Name" git config --global user.email firstname.lastname@example.org
- In terminal, navigate to the folder that contains the project you need versioning on. You might use the Unix commands such as cd or cd .. and ls or pwd to see where you are in the folder structure (you know a bit of Unix, right ?)
- Once in the right folder, type the following command
- Now, your project has its own local repository but it is empty. You must add all your sources files to your local, newly created, repository.Type
git add *
- Now you need to commit the changes in your local repository :
git commit -m “your commit message”
Commiting is like signing or validating your code.
- Check the status of your repository with
Ok now lets get a nice visual tool for all this. While you can find many visual tools (free or not) I strongly suggest to begin with a free one and then, when you’ll get more familiar with GiT you might find one that better suits you.
From the Apple App Store you can get a free copy of SourceTree. In my opinion….it kicks asses right from the start. It’s done by the same guys who made JIRA.
If I want to make a private project with a repo for zero bucks I strongly suggest bitBucket !