Home  >  

Intro To Git

Author photo
February 26, 2010 | | Comments (3)
AddThis Social Bookmark Button
aft_logo.jpg

Advanced Flash Tactics or AFTs are techniques that come from deep within the Flash Art Of War, the oldest Flash military treatise in the world. In this AFT I will go over - Intro To Git. Everywhere you look it seams like Flash Developers are abandoning Google Code in droves for the green pastures of GitHub. Git has been on my radar as a Version Control for some time now but with the cool factor GitHub provides I finally made the switch over and never looked back. Here are some tips for getting started, how to use github and why I suggested making the switch:

What is Git?

Git is a free distributed revision control, or software source code management project with an emphasis on being fast. Git was initially designed and developed by Linus Torvalds for Linux kernel development. Every Git working directory is a full-fledged repository with complete history and full revision tracking capabilities, not dependent on network access or a central server. - wikipedia

Advantages Over SVN

Git is a Distributive Version Control System. You have several ways to checkout a code base and commit changes back. The main advantage to this is keeping a local copy of the entire repo then pushing all of your commit back to the master repo when you are satisfied. In traditional SVN setups if you wanted to take advantage of Version Control you had to commit your code and that may break other people work or cause issues. With Git each developer has their own sandbox they can work in and only push back changes when they are done.

Git uses a single directory to store information about the project. Unlike SVN that keeps .svn folders in each directory, Git simplifies this by with a single .git folder in the root of your checkout. This has huge advantages when it comes to moving files around and not breaking the file history. Plus Git is smart enough to analyze the file's contents instead of where it sits in the projects folder structure so renaming and moving files do not break the reference back to to their history.

Branches are cheap to create. Everything is a branch in Git, unlike SVN where you would have a Trunk and Branches and each branch is a copy of the source. Git allows you to quickly make a new branches and move between them at will. Tags are also incredibly easy to create.

Git can actually work with SVN repos. It has the ability to re-sync it's own commits to a SVN repo and may people have used it to get around situations when using SVN is mandatory but you want the speed and power of Git. I have not got this to work myself but I have read/heard it is relatively seamless and works as one would expect.

Disadvantages

Git has a learning curve coming from SVN or CVS. There are not many shortcuts for complex commands and things you expect to work in SVN like revert have different functionality in Git.

Git is not widely supported. There are few GUIs to simplify using Git like there are for SVN and the command line scares people.

Why Github is cool

Github is not only a repo for your code but it acts as a social network for developers. This is something I don't take as much advantage of as I should considering but the community it creates is great. Not only can you follow other developers you are interested in but you can fork their code (create your own branch that retain the connection to the source you copy from) and contribute as if you were part of the project. Owners of the codebase can see your changes and merge them into the main project or you can just go off on your own direction.

Github also allows people interested in your code several ways to get it. They can make a clone of the project on their local computer or just click download and get a zip of the project without the git directory. This has may advantages over traditional repos since beginners may not want to learn git or have the ability to download the source unless you zipped it up and posted it yourself.

Git Cheat Sheet

Here are some common git commands I use on a daily basis:

  • git init - creates a git repo
  • git pull - pulls down changes from a repo
  • git push - pushes commits back to the master repo. I tend to use push origin master for the main project or push --all to push everything up including tags.
  • git tag [TAG NAME] - This allows you to tag your repo. To find out what tags you have simply type in git tag to see a list.
  • git branch [BRANCH NAME] - This is similar to making a tag. You can see a list of branches along with a * for the one you are in by typing in git branches.
  • git checkout [BRANCH NAME] - Allows you to switch to a branch.
  • gitk --ll - Only use this on a repo that doesn't have a lot large history. This will launch a tool that will help you visualize the repo along with all the comments and displays each branch/tag. Very good help when you messed something up and need to backwards through older commits to fix the mistake.

Git Resources

Kevin Suttle has been putting together an excelent list of Git resources here and here. Below are a few I think are manditory reading.

Closing Thoughts

Once you get over the learning curve, Git is an amazing version control tool and one I highly suggest checking out. I would love to say that I could answer peoples questions below but I am still learning git myself. As far as questions on how it fits into my Flash workflow now I can freely answer. Also please leave a comment with any advice, links, or tips you may have for others getting started.

This post was edited by Ronda Lee Levine.

Read more from Jesse Freeman. Jesse Freeman's Atom feed TheFlashBum on Twitter

Comments

3 Comments

Conrad Winchester said:

Hi

I have recently made the transition from SVN to Git. Whilst doing this I have made a couple of posts on my blog about integrating Flash Builder, EGit and GitHub. I need to make one more to finish the 'series', but I think they can help get anybody interested on their way.

Conrad

Conrad Winchester said:

Hi,

I have recently switched completely from SVN to Git.Whilst doing so I have written a couple of posts on my blog about integrating Flash Builder, EGit (a Git plugin for eclipse) and GitHub.

You can find the first two in the 'series' at

http://www.dz015.com/?p=91

and

http://www.dz015.com/?p=118

I hope they are useful

Conrad

Sean said:

I am also using git as my primary version control system. It is worth noting that using git WITH svn is actually quite easy using git-svn. So, if the centraol repository of a favorite project is svn-based, just clone the repository with git, work locally until satisfied, then dcommit back to the svn repository.

Leave a comment


Type the characters you see in the picture above.


Tag Cloud

Technical Speakers

Who is the best technical speaker you have seen?

Answer

Latest Features

Recommended for You

@InsideRIA on Twitter

Archives

  • Or, visit our complete archive.  

About This Site

Welcome to the premiere community site for all things RIA sponsored by O'Reilly Media and Adobe Systems Incorporated.