background preloader

Tech Talk: Linus Torvalds on git

Tech Talk: Linus Torvalds on git
Related:  git

tortoisegit - Where are git database files stored on windows Git Learning · Normal Workflow Make and view changes made, then stage and commit them. So you have a Git repository and everything is all setup. What now? Generally, it is not going to be much different than working with any other source control system. The only real difference should be the staging process. The workflow will generally go something like this: modify files see what you’ve changed stage the changes you want to commit commit your staged changes rinse, repeat That is the most complex case. modify files commit your changes repeat Easy peasy. the simple case The first thing we’re going to do is modify some files. $ git clone $ cd simplegit For this first example we’ll modify the README file to add ourselves as an author on the project. First, we simply edit the file. A prompt for a commit message will open in our editor (the $EDITOR environment variable or ‘core.editor’ git config variable - by default it uses ‘vim’) that looks like this: using the staging area

Thank You, Larry McVoy by Richard M. Stallman For the first time in my life, I want to thank Larry McVoy. He recently eliminated a major weakness of the free software community, by announcing the end of his campaign to entice free software projects to use and promote his nonfree software. Soon, Linux development will no longer use this program, and no longer spread the message that nonfree software is a good thing if it's convenient. My gratitude is limited, since it was McVoy that created the problem in the first place. There are thousands of nonfree programs, and most merit no special attention, other than developing a free replacement. McVoy made the program available gratis to free software developers. The free software movement has said, “Think of ‘free speech,’ not ‘free beer’” since 1990. McVoy's great triumph was the adoption of this program for Linux development. Of course, the Linux developers had practical reasons for what they did.

The Git Parable Git is a simple, but extremely powerful system. 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

First-Time Git Setup Now that you have Git on your system, you’ll want to do a few things to customize your Git environment. You should have to do these things only once; they’ll stick around between upgrades. You can also change them at any time by running through the commands again. Git comes with a tool called git config that lets you get and set configuration variables that control all aspects of how Git looks and operates. These variables can be stored in three different places: /etc/gitconfig file: Contains values for every user on the system and all their repositories. On Windows systems, Git looks for the .gitconfig file in the $HOME directory (%USERPROFILE% in Windows’ environment), which is C:\Documents and Settings\$USER or C:\Users\$USER for most people, depending on version ($USER is %USERNAME% in Windows’ environment). Your Identity The first thing you should do when you install Git is to set your user name and e-mail address. Your Editor $ git config --global core.editor emacs Your Diff Tool

tortoisegit - Porting TortoiseSVN to TortoiseGit Git Version of TortoiseSVN. It is a port of TortoiseSVN for Git. TortoiseGit supports you by regular tasks, such as committing, showing logs, diffing two versions, creating branches and tags, creating patches and so on (see our Screenshots or documentation). You're welcome to contribute to this project (help on coding, documentation, Translation, testing preview releases or helping other users on the mailing lists is really appreciated). If you upgraded to TortoiseGit 1.8.8.0 and TortoisePLink reports "missing MSVCR110.dll", go to TortoiseGit settings, Network and select "TortoiseGitPLink.exe" as ssh client (which is located in the TortoiseGit\bin directory; issue #2156 ). There seems to be a bug in the MFC library, so please make sure you have the latest service pack installed. The latest and recommended release of TortoiseGit is: 1.8.8.0, see ReleaseNotes for details. Download TortoiseGit System prerequisites and installation howto Get a full list of screenshots. Context menu Commit Dialog

What a Branch Is To really understand the way Git does branching, we need to take a step back and examine how Git stores its data. As you may remember from Chapter 1, Git doesn’t store data as a series of changesets or deltas, but instead as a series of snapshots. When you commit in Git, Git stores a commit object that contains a pointer to the snapshot of the content you staged, the author and message metadata, and zero or more pointers to the commit or commits that were the direct parents of this commit: zero parents for the first commit, one parent for a normal commit, and multiple parents for a commit that results from a merge of two or more branches. To visualize this, let’s assume that you have a directory containing three files, and you stage them all and commit. Staging the files checksums each one (the SHA-1 hash we mentioned in Chapter 1), stores that version of the file in the Git repository (Git refers to them as blobs), and adds that checksum to the staging area: Figure 3-1. Figure 3-2.

Styling Mercurial’s CLI / hg tip Styling Mercurial’s CLI posted by Steve Losh on January 15, 2010 Mercurial has a great command line interface and many people use it without ever feeling the need for a GUI to manage their repositories. However, we can make it even better by taking advantage of Mercurial’s templating features. In this tip I’m going to post some of the templates I use and show you how to use them yourself. If you like what you see you can grab my templates by cloning their repository from BitBucket: hg clone NOTE: I’ve customized the colors of my Terminal, so the colors will look different for you. Short Log In a previous tip I described how to create an hg slog alias that can be very useful for counting changesets. To use this template you can edit your ~/.hgrc file to contain the following: [alias] slog = log --style=/full/path/to/map-cmdline.slog Nice Log [alias] nlog = log --style=/full/path/to/map-cmdline.nlog Short Graphlog Contribute

Git Basics So, what is Git in a nutshell? 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 Git Has Integrity Git Generally Only Adds Data

Related:  scmengineering