Last active
February 27, 2025 17:47
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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