Skip to content

Instantly share code, notes, and snippets.

@sean9999
Last active February 27, 2025 17:47
Show Gist options
  • Save sean9999/1a44106fab567cabdd8ae2998ed0ca53 to your computer and use it in GitHub Desktop.
Save sean9999/1a44106fab567cabdd8ae2998ed0ca53 to your computer and use it in GitHub Desktop.
cat the contents of all elixir files that have changed in a git repo. Useful for hot code swapping
#!/usr/bin/env bash
exename=$(basename $0)
function show_help () {
echo "$exename: cat changed files since a specific commit"
echo "call it like this: $exename develop"
echo "where develop is the original branch"
echo "it will cat all the changed elixir files"
}
if [[ -z "$1" ]]; then
show_help
else
cat $(git diff --name-only $1 | grep '**.ex')
fi
#!/usr/bin/env bash
exename=$(basename $0)
function show_help () {
echo "$exename: cat old files from a specific commit"
echo "call it like this: $exename develop"
echo "where 'develop' is the commit/branch/tag you want to use"
echo "it will cat all the files as they were on that commit"
}
if [[ -z "$1" ]]; then
show_help
else
for filename in $(git diff --name-only $1 | grep '**.ex'); do
git show $1:./$filename
done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment