Skip to content

Instantly share code, notes, and snippets.

View matthieua's full-sized avatar

Matt Delac matthieua

View GitHub Profile
@joahking
joahking / confirm_dialog_steps.rb
Created March 2, 2011 15:03
bypass confirm dialog
Then /^(.+) and I confirm dialog box$/ do |step|
bypass_confirm_dialog
Then step
end

Rebasing Merge Commits in Git

This morning I discovered a nasty little problem with git-rebase that can have pretty unexpected and unwanted results - how it handles a merge commit.

The TL;DR version is this: Always use git rebase -p

Why I use pull --rebase

I think a lot of people are using git pull --rebase as their default to avoid unnecessary merge commits when fetching the latest code from master. There are a few blog posts on the matter, such as [1] [2]

def deep_copy(object)
case object
when Array
object.map { |item| deep_copy(item) }
when Hash
object.inject({}) do |hash, (key,value)|
hash[deep_copy(key)] = deep_copy(value)
hash
end
# handle other data structures if need be