Skip to content

Instantly share code, notes, and snippets.

@alloydwhitlock
Created December 12, 2018 01:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alloydwhitlock/0db379a6e0ad6581711161e0bce9322e to your computer and use it in GitHub Desktop.
Save alloydwhitlock/0db379a6e0ad6581711161e0bce9322e to your computer and use it in GitHub Desktop.
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