Posts tagged with “Git”

A successful Git branching model

This is why I love Git so much: it makes complex workflows, like the one to which I’ve linked, really simple to implement. I can’t even imagine trying this in Subversion.

Posted on February 4, 2010 Leave a Comment
Tagged with: , ,

Why You Should Switch from Subversion to Git

Scott Chacon delves into why you should switch to Git. Once you switch to Git, make sure to try out my Git workflow.

Posted on September 15, 2009 Leave a Comment
Tagged with: , , ,

Compiling Ruby, RubyGems, and Rails on Snow Leopard

Dan Benjamin walks through how to install Ruby, RubyGems, and Rails on Snow Leopard. Also be sure to check out his other Snow Leopard guides for Mercurial, Git, and MySQL.

Posted on September 1, 2009 Leave a Comment
Tagged with: , , , , , , , ,

Rebase like a boss

Nick Quaranto on why you should rebase instead of merge when using Git:

Everyone who loves Git hopefully loves branching. However, there’s a problem with branching: merging your work back in. Suprisingly enough, Git’s inflexibility makes this action quite simple. It’s my opinion that Git users should be branching frequently, and rebasing them back into the mainline when ready.

This is my basic philosophy when using Git: the cleaner you keep your history graph, the better.

Posted on August 18, 2009 Leave a Comment
Tagged with: , , ,

Beanstalk will support Git

Over on the Beanstalk blog, Chris Nagele announces that Beanstalk will be supporting Git. We use Beanstalk at Viddler–it’s a superb application, and adding Git will make it even better.

Posted on August 12, 2009 Leave a Comment
Tagged with: , , , ,

The Perfect Git Workflow for a One Person Project

A few months ago, I started investigating Git, and I fell in love with how much easier it made managing my code. I’m managing the source code to this site with Git, and along the way I’ve come up with a pretty good workflow for myself. The basic steps are:

  1. Branch
  2. Commit
  3. Rebase
  4. Merge
  5. Deploy

Let’s go through each one to see how it all works together.

Branch

With SVN, I found myself hating branching–it was always a complicated procedure, and I could never remember how to do it. In Git it’s as easy as git checkout -b <branch-name>, and you’re ready to go. Once you have a branch, you can modify it however you want, and you don’t have to worry about interfering with the master branch. In order to keep your master branch bug free, commit only to branches, not to master itself.

In addition to creating new branches for major features, I always have a few branches around that I pop into for certain things:

  • “design” - any changes I want to make to the design go here
  • “optimize” - optimizations to the site
  • “bugfixes” - a place to work on minor bugfixes

Having these branches allows me to make small fixes to the site, and if it turns out it’s more than just a small fix, it doesn’t interfere with anything else.

Commit

In the Subversion world, it’s a pretty common practice to make very large commits, consisting of many changes. With Git, you should constantly be committing. By making many commits, you make it easier to find bugs you may have introduced, and it makes it a lot easier to track your progress. If you don’t like the thought of wading through long lists of commits in your logs, don’t worry–before bringing it over to the master branch, you can consolidate things with interactive rebasing, but while you’re hacking away on a branch, it really is advantageous to have many small commits.

Rebase

Rebasing is one of the harder things to grasp when you’re first learning about Git. For in-depth coverage of the topic, check out the Rebasing page in the Git Community Book. In a nutshell, doing git rebase master takes any commits to master and inserts them into your current branch, so you can then make sure your new code still works, and it’s a lot less hazardous than doing a merge. Rebasing your branch before putting into master is really important because it allows you to deal with any merge issues before the code goes to your main branch. To rebase, just run git rebase master.

Merge

After rebasing the branch, it’s safe to merge it into master. Since I’ve already dealt with any merge issues with the previous step, it’s as simple as checking out the master branch and running git merge <branch-name>

Deploy

I use Capistrano to deploy my code, so I’m constantly typing git push followed by cap deploy to deploy changes to my server. To make it easier, I just put both commands into one git alias:

deploy = !git push && cap deploy

Now I just need to run git deploy and it automatically pushes all of my changes to the remote Git repository and then deploys the site using Capistrano. Here’s some more information about Git aliases.

Useful tools

Though I primarily use Git through the command line, I really like using GitX to visualize branches. To host my repositories on my server, I use Gitosis, though if I had a few more projects, I’d dole out the money for a paid account at GitHub.

Have a great Git workflow? Think mine’s terrible? Let me know in the comments!

Posted on July 30, 2009 4 Comments
Tagged with: , , , ,

Deploying ExpressionEngine from GitHub with Capistrano

Dan Benjamin takes you step-by-step through deploying ExpressionEngine from GitHub with Capistrano in a really in depth tutorial. I’m definitely going to have to set this up for my EE sites.

Posted on June 2, 2009 Leave a Comment
Tagged with: , , , , ,

A Git Workflow for Agile Teams

Rein Henrichs does a great job explaining an agile git workflow for teams, and I found it to be very helpful, even for my 1-person projects (e.g. this site). I’ve always been a little confused as to when I should rebase and when I should merge, but after reading through this, it makes a little more sense now.

Posted on March 9, 2009 Leave a Comment
Tagged with: , , ,

The Thing About Git

Great post by Ryan Tomayko about some more advanced Git topics involving the commit staging area, or the “index.” I have fallen completely in love with Git, and I love all the little extra things I keep learning about.

Posted on January 19, 2009 Leave a Comment
Tagged with: , , ,

A Gaggle of Git Tips

Some great tips for working with Git from the team over at Viget

Posted on January 12, 2009 Leave a Comment
Tagged with: , ,

Why I won't be buying Versions

Today, Versions, a Subversion app for OS X, moved to version 1.0, marking the end of its free beta period. While many people will be shelling out the €39 (~$49) for a license, I won’t be doing the same. Having used Versions for a couple months now, it just isn’t for me.

I don’t need a fancy UI.

When I loaded Versions for the first time, I was impressed by the amount of work that went into the UI. It looked nice, and it worked pretty well too. However, I found myself working harder to accomplish simple tasks than when I used the command line. For me, it’s a lot easier to cd to the directory in the Terminal and do a svn stat rather than take the time to load up Versions and do a similar command. Even though it might be nicer to look at, Versions was just never quite as quick or intuitive as the terminal commands I had grown used to. In addition, I almost always have the Terminal open, as I’m constantly running commands during development. Having to open up another app just got in the way of my workflow.

I already use TextMate.

TextMate is the center of my coding world. It is quite simply the greatest text editor I have ever used, and it’s where I spend the vast majority of my time when I’m coding. Built into TextMate is a great SVN plugin that really makes Versions unnecessary. Without changing applications, I just hit CTRL+SHIFT+A and I’m greeted with a list of SVN commands. I tap 5, and I see a dialog where I can set my SVN commit message and choose exactly which items I want to commit from a list of changed files. Why would I need anything more sophisticated than that? If I wanted to go ahead and commit a few files with Versions, I’d have to fire up the application, locate the files I want, and hit commit. The worst part is, at least in the beta version I used, there’s no good way to select multiple files in Versions without resorting to holding the command key and clicking each file. In TextMate, it’s as simple as checking boxes.

Git is the future.

My biggest problem with spending close to $50 on a Subversion app is that I really don’t want to use SVN any more. I’ve fallen in love with Git, a distributed version control system that puts Subversion to shame. Just about every new personal project I start will be using Git, so there’s really no point in buying a program just to manage my older projects. If Versions supported Git as well, I’d definitely be considering adding it to my arsenal.

A Grain of Salt

Now, just because Versions hasn’t worked its way into my routine doesn’t mean it can’t be part of yours. I personally know several people that really enjoy Versions, and it has really improved their workflow. It’s definitely a well-made product, it just doesn’t work for me.

Also, if you’re in the market for an OS X client for SVN, definitely check out Cornerstone as well. While I haven’t used it personally, I’ve heard good things about it.

Posted on November 17, 2008 5 Comments
Tagged with: , , , , , , ,

Hosting Git Repositiores, the Easy (and Secure) Way

Excellent tutorial on how to setup and host git repositories using Gitosis. I had this up and running on my Slicehost server in less than 15 minutes.

Posted on November 2, 2008 Leave a Comment
Tagged with: , ,