Skip to content

Instantly share code, notes, and snippets.

@simonwhitaker
simonwhitaker / git-is-ancestor
Last active April 5, 2022 08:01
A script to determine whether one git commit is the ancestor of another
#!/bin/bash
#
# git-is-ancestor, by Simon Whitaker
#
# Suggested usage
#
# Store this file somewhere, make it executable, then alias
# it to git is-ancestor by putting this in your $HOME/.gitconfig:
#
# [alias]
#!/bin/sh
# OBJC_HELP=1 causes the Objective-C runtime to spit out help to stderr
# Pulling in osx/cocoa causes the runtime to be loaded via RubyCocoa
# Redirect sterr to stdout so we can pipe the results through pager
OBJC_HELP=1 /usr/bin/ruby -rosx/cocoa -e '' 2>&1