Created
April 19, 2025 16:12
-
-
Save bigsnarfdude/25013909c701578913178c5bb22eb98d to your computer and use it in GitHub Desktop.
bash to zip git all files for checkins
This file contains hidden or 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
# 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