Source Control: A Time Machine For Your Source Code
What is source control and why should you use it?
Source control lets you keep every single version of your files. Over time your files change as you make modifications to them. If you’re working on a single file like a document, not tracking those changes is fine, but your source code needs to be tracked even if you are a lone developer. When you are developing an app, sometimes you start down a path that you think will be fruitful, but then you quickly discover that the implementation will not work as well as you thought it would. Using a version control system (VCS) allows you go back to the state of the code before you implemented the feature. Source control is like a time machine for code. If you want to go back, just look at the history and load up the code at that point in time.
Another scenario where a VCS is extremely helpful is when you are working on a team, and you and a teammate are working in the same file. This is impossible without source control because when you save you might overwrite your teammate’s changes or vice versa. Without a VCS, this usually leads to naming files with some sort of version scheme (i.e. MyCode-20100322.cs, SharedClass-FINAL.cs, SharedClass-DONOTTOUCH.cs, and so on…) Instead VCSs recognize that the file has changed and lets you merge your changes in with your teammate’s changes ergo preserving both of your changes.
Whether you are in a team or a lone developer, you can benefit from using source control to manage your code. Source control systems also do not require a particular type of file. You can use a VCS to manage any type of file: Microsoft Word, HTML, images, text files, or even binaries. The merging capabilities are only useful with text based files, but the VCS can preserve the version of binary files.
How can you get started with Version Control?
How much would you pay for a sophisticated Version Control System? $200? $1,000? $40k? Although having such a great tool may be worth the money, the good news is that some of the best VCSs are free. Corporations and large organizations are using some of these free VCSs:
These applications are free as in they have no cost and as in you have rights to use them as you see fit. Git is the most versatile and the most popular VCS so I will cover it in this post, but feel free to investigate the others.
Git was originally created to be used on the command line, but there are a few graphical front-ends for git such as the included Git GUI and Git-cola. However you use Git, here is the basic usage for Git:
- Clone an existing Git repository (git clone)
- Add/modify files already added to the repository
- Stage the files that will be committed to the server (git add)
- Write a commit message that details your change.
- Commit to the repository.
That’s it. The changes are saved and you can review them later when you need to (using git log).
It’s worth noting that everything done has been without the need of an internet connection. One of Git’s strengths is that it sets up a local repository. This means that you can keep your changes tracked locally and it doesn’t require a connection to a central repository.
Using Git you can collaborate with others using the push and pull feature. By setting up an external repository on another machine or a hosted repository like GitHub you can pass the URL of the repository to your friends, co-workers, team members, etc. and they can clone the repository and make changes locally and commit them back to the repository. The workflow for that looks something like this:
- Get a copy of the repository (git clone)
- Make your own changes (git add and git commit)
- Send them back to the server where you got them (git push)
- Get changes made by others (git pull)
Here are some resources to learn more about using git.
Git Home Page - http://git-scm.com/
Install git on Windows - http://help.github.com/win-git-installation/
Install git on OS X - http://help.github.com/mac-git-installation/
Git for Windows Developers - http://www.lostechies.com/blogs/jason_meridth/archive/2009/06/01/git-for-windows-developers-git-series-part-1.aspx
Pro Git (free online version of the book) - http://progit.org/
Jesse Dearing is a Developer for Fellowship Technologies. He likes learning about new technologies and languages (especially ones that are used on the web) as well as learning about new trends and practices in software development. He is passionate about software development and helping other developers.
Posted In: Tips,
- Include Requirements & Contribution Sub Types
- User Case Story from Hope Community Church
- Group Search Categories and More
- Account Creation
- Single Sign On Functionality Exposed
- API Communication Value Changes
- API Enhancement: Create and Edit Groups!
- API Enhancement: Requirements Exposed
- Resource Versioning
- Enter Visitor Data via Your Church Website
- Fellowship One & Planning Center Online
- API Libraries and Sample Code
- Building a custom login for your church website using the API
- Roll Foward!
- The Agile Triangle
- Conversation Paralysis
- Picture this, image updates & creates through the REST API
- A REST API double shot : Groups and Events realms
- Increasing Software Delivery by 500%
- Quick people API realm update
- Introducing the new REST API giving realm
- Raising the bar…
- Building a Deployment Pipeline
- The World of Dev Craft
- Running Tests in Parallel with Selenium
- Abstracting Your Code to Remove Duplication
- Documentation in an Agile Environment
- Drowning in Debt
- Intro to Ruby on Rails
- API Strategy & Roadmap
- Staging/Sandbox Environment is Back up!
- Downtime in Sandbox/Staging Environment
- Android & OAuth
- F1 API Static Library with Objective-c
- Programming in F#
- NoSQL: HuMONGOus Benefits (Part 2)
- Our Scrum Team Structure
- SaaS & BI - The History & Future
- Getting Started with Android
- NoSQL: Leaving Schema Behind (Part 1)
- Your Feedback…and a $25 Gift Card!
- A Scrum Ceremony? Is this a wedding or something?
- Variables in PHP
- Data Exchange API Fixes
- F1 Check-in on the iPad
- Be the first to get the news & tips!
- An Introduction to PHP
- Working with Pop Up Windows in Selenium
- List Comprehension
- Source Control: A Time Machine For Your Source Code
- Developer Conference…Lower Price, Same Great Content!
- The Quality Assurance Team
- How does Fellowship Technologies manage complex projects?
- Developer Conference coming in May!
- Sandbox Refresh Complete
- Sandbox Refresh This Week
- Updates coming to the REST API
- Sandbox Environment Down Time
- F1Touch :: Fellowship One On The Go
- Under the Hood
- Sandbox Refresh Complete
- Sandbox Refresh Tomorrow (Oct. 2nd)
- Fellowship One Developer Forums
- Ten Commandments of API Consumption
- REST API Enhancements / Fixes deployed to Sandbox and Production 09.09.09
- Data Exchange URL cut-over complete
- Important Data Exchange URL changes
- Ron Nom Nom
- How to get started using the REST API