git

git

The Git “topic branch” workflow (pattern)

In this short article, I’ll demonstrate the typical workflow for using a Git topic branch. If you’ve never heard of a topic branch, here’s a description from the excellent book, Pro Git:

“A topic branch is a short-lived branch that you create and use for a single particular feature or related work.

Tell Git not to track a file any more (remove from repo)

Git rm FAQ: How do I tell Git not to track a file (or files) any more? That is, I want to remove the file from the Git repo?

While working on an application named "sarah" yesterday (named for the house known as "SARAH" in the tv series Eureka), I accidentally checked some files into Git that I didn't mean to. These were were primarily binary files in my project's "bin" and "target" directories.

git status message - Your branch is ahead of origin/master by X commits

git status FAQ: When I issue the "git status" command, I see the following "Your branch is ahead or origin/master ..." git message:

# On branch master
# Your branch is ahead of 'origin/master' by 5 commits.
#
nothing to commit (working directory clean)

What does this "Your branch is ahead of 'origin/master' by X commits" message mean? I keep committing my changes with "git commit", so this message seems to be in error.

Git export: How to export a Git project

Git export FAQ: How do I export a Git project, like I would do with a "cvs export" or "svn export"?

There is no "git export" command, so instead you use the "git archive" command. By default, "git archive" produces its output in a tar format, so all you have to do is pipe that output into gzip or bzip2 or other.

Git export example

Here's a simple Git export command I just ran. I moved into the root of my Git project directory, then ran this command to create a new file named "latest.tgz":

Git shortcuts/aliases - How to create

Git shortcuts FAQ: Can I create Git shortcuts (aliases) so I don't have to type out full Git commands like "git commit..."?

I've been reading the Pro Git book a lot lately, and the short answer is yes, you can create Git shortcuts so you don't have to type out the long Git commands. Here are several Git shortcut commands (referred to as "git aliases") from the Pro Git book:

Git: How do I add an empty directory to a Git project/repository?

Git empty directories FAQ: How do I add an empty directory to a Git repository?

Short answer - you can't. (See below for the workaround.) The design of the Git staging area only accounts for files, as described in the Git FAQ, and other books like Pro Git.

Git empty directories FAQ

Here's the text from the Git FAQ section, "Can I add empty directories to a Git repository":

Private Git repository hosting services alvin December 12, 2010 - 2:47am

Private Git hosting services FAQ: What companies offer Git hosting, in particular private Git hosting services?

I recently started looking for a private Git hosting service, and the obvious first place to look is GitHub. They provide free Git hosting for open source projects, and their service has been excellent. But when I looked at their private Git hosting service, I was really surprised by the cost of their plans. Their lowest price private Git hosting plan is $7/month, and that allows only five Git projects, and relatively little disk space. Since I want a private Git hosting service to store all my projects, I'd immediately need to go to one of their paid Git hosting plans, and their Git hosting prices go up quickly from there.

Update: Github has changed their policies significantly since I first wrote this article.

How to install Git on Mac OS X

Mac Git installation FAQ: How do I install Git on Mac OS X?

There are at least two different ways to install Git on Mac OS X systems, and I've used both of these methods. The first approach is to use a Mac GUI installer, and the second is to use the command-line MacPorts project to install Git on Mac OS X.