Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Simple Git branch hash visualizer thing
#!/bin/bash
# This is a quick & dirty way of comparing a bunch of various repositories
# visually to understand divergence. Made this very relaxed so anyone with
# shell experience can modify it to their whim.
#
# Suggestions include having comparitive operations between branch names,
# maybe giving an error if ANY divergence is encountered, or maybe trying
# to automatically merge branches if doing something silly like Git flow.
# Array of services to check
services=(service_one service_two service_three)
service_dir=$(pwd)
# Checkout services from Git, check branches
for service in ${services[@]}; do
cd ${service_dir}
if [[ ! -d ${service} ]]; then
git clone git@github.com:alloydwhitlock/${service}.git
cd ${service}
git checkout feature_branch
git checkout release
else
cd ${service}
fi
feature_branch=$(git rev-parse origin/feature_branch)
master=$(git rev-parse origin/master)
echo "${service}: ${feature_branch} & ${master}"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment