background preloader

Introduction to git

Facebook Twitter

Git Basics. So, what is Git in a nutshell?

Git Basics

This is an important section to absorb, because if you understand what Git is and the fundamentals of how it works, then using Git effectively will probably be much easier for you. As you learn Git, try to clear your mind of the things you may know about other VCSs, such as Subversion and Perforce; doing so will help you avoid subtle confusion when using the tool. Git stores and thinks about information much differently than these other systems, even though the user interface is fairly similar; understanding those differences will help prevent you from becoming confused while using it. Snapshots, Not Differences The major difference between Git and any other VCS (Subversion and friends included) is the way Git thinks about its data.

Figure 1-4. Git doesn’t think of or store its data this way. Figure 1-5. This is an important distinction between Git and nearly all other VCSs. Nearly Every Operation Is Local. Tech Talk: Linus Torvalds on git (70 minutes) Git Basics 4: Content, not files (5.1 minutes) Git Basics 3: Get Going (4.5 minutes) Git Basics 2: Local Git (8.25 minutes)

Git Basics 1: What is version control? (6 minutes) The Git Parable. Git is a simple, but extremely powerful system.

The Git Parable

Most people try to teach Git by demonstrating a few dozen commands and then yelling “tadaaaaa.” I believe this method is flawed. Such a treatment may leave you with the ability to use Git to perform simple tasks, but the Git commands will still feel like magical incantations. Doing anything out of the ordinary will be terrifying. Until you understand the concepts upon which Git is built, you’ll feel like a stranger in a foreign land. The following parable will take you on a journey through the creation of a Git-like system from the ground up. The Parable Imagine that you have a computer that has nothing on it but a text editor and a few file system commands. Snapshots Alfred is a friend of yours that works down at the mall as a photographer in one of those “Special Moments” photo boutiques. You start your project in a directory named working.

Branches After a bit of time on the project, a candidate for release begins to emerge. Branch Names. Introduction to svn.