My Github Pull Request Workflow

git logo

Let's say I'm taking pull requests for node_redis.

Here's how I go about it.

export NUM=214 # for convenience
curl -s$NUM.patch > $NUM.patch

# see what changed, and make sure it applies cleanly
git apply --stat $NUM.patch
git apply --check $NUM.patch

# add the commits to master
git am --signoff < $NUM.patch

# if I need to make some changes, I do the following and put "e" next
# to the commits that need changes
git rebase -i origin/master

# If there's only one commit in the PR, I use
git commit --amend
# (you should make an alias for this)

Yes, rebase can be scary. I recommend reading about how to undo anything using git's reflog, even a botched rebase or merge.

Update: here are some simpler ways:

export NUM=8
curl -s$NUM.patch | git am --signoff

Or even add this to your ~/.gitconfig (via piscisaureus)

  # via
  pullify = config --add remote.origin.fetch '+refs/pull/*/head:refs/remotes/origin/pr/*'

David Trejo

Growth Engineer at Credit Karma & consultant. Past clients include Aconex, Triplebyte, Neo, Brown Computer Science Department, Voxer, Cloudera, and the Veteran's Benefits Administration.

Want to be a better Full Stack Growth Engineer?

You'll get articles on everything I learn as a growth engineer at Credit Karma, a profitable private company with >80 million members, >$4 billion valuation, and >900 employees.