Skip to content

Instantly share code, notes, and snippets.

@bigsnarfdude
Created April 19, 2025 16:12
Show Gist options
  • Save bigsnarfdude/25013909c701578913178c5bb22eb98d to your computer and use it in GitHub Desktop.
Save bigsnarfdude/25013909c701578913178c5bb22eb98d to your computer and use it in GitHub Desktop.
bash to zip git all files for checkins
# Define the oldest and newest commit hashes
OLDEST_COMMIT="e8264b948705ec4adefb9caa875c569753134516"
NEWEST_COMMIT="5b524772c15f9b7cff017bdb000db40709da28a4"
# Create a temporary directory to store the files
mkdir -p rails6_upgrade_files
# Get list of all changed files between these commits
git diff --name-only $OLDEST_COMMIT..$NEWEST_COMMIT > changed_files.txt
# Copy each file to the temporary directory with its directory structure
while IFS= read -r file; do
if [ -f "$file" ]; then
mkdir -p "rails6_upgrade_files/$(dirname "$file")"
cp "$file" "rails6_upgrade_files/$(dirname "$file")/"
fi
done < changed_files.txt
# Create a zip file with all the changed files
zip -r rails6_upgrade_files.zip rails6_upgrade_files
# Clean up the temporary directory
rm -rf rails6_upgrade_files
rm changed_files.txt
echo "All files from the Rails 6 upgrade have been zipped to rails6_upgrade_files.zip"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment