jbaron/cats — pull request #139 by fasterthanlime (2014-12-30 21:11:55+00:00)
Title: Better shortcuts

Cf. discussion in #138.

For reference, here's how you can integrate someone else's changes from a fork:

### 1. Add the remote

I usually name them from the github username of the person with the fork:

> git remote add fasterthanlime https://github.com/fasterthanlime/cats.git

### 2. Fetch the new commits

The easy way:

> git fetch --all

Then you can see in your branch list that you've got `fasterthanlime/better-shortcuts`

> git branch --list --all

Or, you can be more precise:

> git fetch fasterthanlime better-shortcuts

### 3. Cherry-pick or merge

If you're only interested in a commit or two, you can cherry-pick them

> git log fasterthanlime/better-shortcuts

Would give you a list of all commits with authors, dates, messages, and most importantly commit hashes (SHA1).

Then you can run cherry-pick with any commit hash, and this will attempt to apply it to your current HEAD:

> git cherry-pick e380b83857eb587ebecdf48587511b16d4e644b2

If you're happy with the state of a distant branch and just want to merge it all, you can check out the changes to a local branch, then switch back to your working branch, and merge it all:

> # this'll check out fasterthanlime/better-shortcuts to a local 'better-shortcuts' branch
> git checkout --branch better-shortcuts
> # switch back to our working branch
> git checkout unstable
> # merge it! :shipit:
> git merge better-shortcuts

Some people prefer to use `rebase` over `merge`, but I always run into problems with rebase — I never quite mastered the art of using it properly (ie. it seems to be trying to reapply past commits and I end up with empty diffs.. eh, git's a mistery sometimes.)

The `git merge` command should be deceptively fast, almost as if it didn't do any work, but a quick `git log` will reassure you on the fact that the commits are, in fact, in your history now (along with a merge commit). Then all you have to do is push.

Or, since I made a pull request for that one, you can just click "Merge" on the GitHub UI and hopefully everything will go smoothly :)